{"id":95,"date":"2023-04-11T13:35:46","date_gmt":"2023-04-11T05:35:46","guid":{"rendered":"http:\/\/blog.byzhb.top\/?p=95"},"modified":"2023-06-18T22:54:18","modified_gmt":"2023-06-18T14:54:18","slug":"phps","status":"publish","type":"post","link":"https:\/\/blog.byzhb.top\/index.php\/2023\/04\/11\/phps\/","title":{"rendered":"PHP\u7279\u6027"},"content":{"rendered":"<h1 id=\"%E5%89%8D%E8%A8%80%EF%BC%9A\">\u524d\u8a00\uff1a<\/h1>\n<p>\u6b64\u6587\u4e2d\u7684PHP\u7279\u6027\uff0c\u90fd\u662f\u535a\u4e3b\u5728CTF\u9898\u76ee\u4ee5\u53ca\u6e17\u900f\u5b9e\u6218\u4e2d\u6240\u9047\u5230\u7684\uff0c\u53ef\u80fd\u6709\u758f\u6f0f\u6216\u4e0d\u5bf9\u7684\u5730\u65b9\uff0c\u8fd8\u671b\u5404\u4f4d\u5927\u4f6c\u591a\u591a\u6307\u51fa\uff0c\u611f\u8c22\uff01<\/p>\n<h1 id=\"1%E3%80%81intval()%EF%BC%9A\">1\u3001intval()\uff1a<\/h1>\n<p><strong>\u683c\u5f0f\uff1aintval (var, base)<\/strong><\/p>\n<ul>\n<li>base: \u53ef\u9009\uff0c\u65e0\u5219\u5341\u8fdb\u5236<\/li>\n<li>\u5982\u679c base \u662f 0\uff0c\u901a\u8fc7\u68c0\u6d4b var \u53c2\u6570\u7684\u683c\u5f0f\u6765\u51b3\u5b9a\u4f7f\u7528\u7684\u8fdb\u5236(0\u5f00\u59348\u8fdb\u5236\uff0c0x\u5f00\u593416\u8fdb\u5236\uff09<\/li>\n<\/ul>\n<p><strong>\u4e00\u4e9b\u7279\u6027\uff1a<\/strong><\/p>\n<blockquote><p><strong>1\u3001\u83b7\u53d6\u53d8\u91cf\u7684\u6574\u6570\u503c<\/strong><\/p>\n<p><strong>\u4f8b\u5982<\/strong> 4.2\u53d64<\/p>\n<p><strong>2\u3001\u4f20\u5165\u7684\u5b57\u7b26\u4e32\u5b58\u5728\u5b57\u6bcd\u65f6\uff0c\u53ea\u4f1a\u53d6\u5b57\u6bcd\u524d\u9762\u7684\u6570\u5b57<\/strong><\/p>\n<p><strong>\u4f8b\u5982<\/strong> 6e123 \u53d66<\/p>\n<p><strong>3\u3001\u51fd\u6570\u91cc\u9762\u6709\u8fd0\u7b97\u5f0f\uff0c\u4f1a\u628ae\u6b63\u786e\u8bc6\u522b\u4e3a\u79d1\u5b66\u8ba1\u6570\u6cd5\u7b26\u53f7\uff0c\u5e76\u8fdb\u884c\u8fd0\u7b97<\/strong><\/p>\n<p><strong>\u4f8b\u5982 <\/strong>intval(1e1+1) = 11<\/p>\n<p><strong>4\u3001\u5728\u6ca1\u6709\u8fd0\u7b97\u5f0f\u65f6\uff0c\u53ea\u4f1a\u53d6e\u524d\u9762\u7684\u6570\u5b57\uff0c\u5e76\u4e0d\u4f1a\u628ae\u770b\u505a\u79d1\u5b66\u8ba1\u6570\u6cd5\u7b26\u53f7<\/strong><\/p>\n<p><strong>\u53c2\u80032<\/strong><\/p>\n<p><strong>5\u3001\u5728\u4f20\u5165\u7684\u53c2\u6570\u975e\u6570\u5b57\u5b57\u7b26\u65f6\uff0c\u4e00\u5f8b\u8fd4\u56de0<\/strong><\/p>\n<p><strong>\u4f8b\u5982\uff1a<\/strong><\/p>\n<p>intval('a')==0 intval('.')==0intval('\/')==0<\/p>\n<p><strong>0\u4e0e\u5b57\u7b26\u4e32\u8fdb\u884c\u5f31\u6bd4\u8f83\u8fd4\u56de\u503c\u4e3atrue\uff0c\u8be6\u7ec6\u8bf7\u770b\u4e0b\u6587<\/strong><strong>\u677e\u6563\u6bd4\u8f83\u8868\u683c<\/strong><\/p>\n<p><strong>6\u3001\u975e\u7a7a\u6570\u7ec4\u8fd4\u56de1\uff0c\u7a7a\u6570\u7ec4\u8fd4\u56de0<\/strong><\/p><\/blockquote>\n<h1 id=\"2%E3%80%81__wakeup()%20%EF%BC%9A\">2\u3001__wakeup() \uff1a<\/h1>\n<p>\u5728\u53cd\u5e8f\u5217\u5316\u4e4b\u540e\u7acb\u5373\u88ab\u8c03\u7528<\/p>\n<p>\u5c06\u53d8\u91cf\u6570\u6539\u4e3a\u5927\u4e8e\u771f\u5b9e\u53d8\u91cf\u6570\u5373\u53ef\u7ed5\u8fc7<\/p>\n<h1 id=\"3%E3%80%81strcmp()%20%EF%BC%9A\">3\u3001strcmp() \uff1a<\/h1>\n<p>\u683c\u5f0f\uff1astrcmp(str1,str2)<\/p>\n<p>\u8be5\u51fd\u6570\u8fd4\u56de\u503c\uff1a<\/p>\n<ul>\n<li>0 - \u5982\u679c\u4e24\u4e2a\u5b57\u7b26\u4e32\u76f8\u7b49<\/li>\n<li>&lt;0 - \u5982\u679c string1 \u5c0f\u4e8e string2<\/li>\n<li>&gt;0 - \u5982\u679c string1 \u5927\u4e8e string2<\/li>\n<\/ul>\n<p><strong>strcmp\u6bd4\u8f83\u7684\u662f\u5b57\u7b26\u4e32\u7c7b\u578b\uff0c\u5982\u679c\u5f3a\u884c\u4f20\u5165\u5176\u4ed6\u7c7b\u578b\u53c2\u6570\uff0c\u4f1a\u51fa\u9519\uff0c\u51fa\u9519\u540e\u8fd4\u56de\u503c0\uff0c\u6b63\u662f\u5229\u7528\u8fd9\u70b9\u8fdb\u884c\u7ed5\u8fc7<\/strong><\/p>\n<p>\u4f8b\u5982\uff1a\u4f20\u5165\u6570\u7ec4\u7c7b\u578b str1[]=666<\/p>\n<p>\u53ea\u6709PHP5.3\u6709\u6b64\u6f0f\u6d1e<\/p>\n<h1 id=\"4%E3%80%81assert()%3A\">4\u3001assert():<\/h1>\n<p>\u4f1a\u628a\u8bfb\u5230\u7684\u5b57\u7b26\u4e32\u5f53\u505aPHP\u6267\u884c,<strong>\u672b\u5c3e\u4e0d\u9700\u8981\u5f15\u53f7<\/strong><\/p>\n<h1 id=\"5%E3%80%81eval()%EF%BC%9A\">5\u3001eval()\uff1a<\/h1>\n<p>\u4f1a\u628a\u8bfb\u5230\u7684\u5b57\u7b26\u4e32\u5f53\u505aPHP\u6267\u884c\uff0c<strong>\u672b\u5c3e\u8981\u6709\u5f15\u53f7<\/strong><\/p>\n<h1 id=\"6%E3%80%81include()%EF%BC%9A\">6\u3001include()\uff1a<\/h1>\n<p>\u6587\u4ef6\u5305\u542b\u6f0f\u6d1e\uff0c\u4f1a\u6267\u884c\u8bfb\u5230\u7684PHP\u6e90\u7801<\/p>\n<p><strong>\u7279\u6027\uff1a<\/strong>\u5373\u4f7f\u8def\u5f84\u4e2d\u7684\u5934\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c\u4e5f\u53ef\u4ee5\u6b63\u786e\u6267\u884c\u5305\u542b\u76ee\u6807\u6587\u4ef6<\/p>\n<p><strong>\u4f8b\u5982\uff1a<\/strong> <strong>hint.php?<\/strong>\/..\/..\/..\/flag.php<\/p>\n<p>hint.php?\u8fd9\u4e2a\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c\u4f46\u4ecd\u80fd\u591f\u5f80\u4e0a\u8df3\u8f6c4\u7ea7\u76ee\u5f55\uff0c\u53bb\u5305\u542bflag.php<\/p>\n<p><strong>\u5e38\u89c1\u7684\u6587\u4ef6\u5305\u542b\u51fd\u6570\u8fd8\u6709\uff1a<\/strong><\/p>\n<blockquote><p><strong>include_once( )<\/strong><\/p>\n<p>\u529f\u80fd\u4e0e Include()\u76f8\u540c\uff0c\u533a\u522b\u5728\u4e8e\u5f53\u91cd\u590d\u8c03\u7528\u540c\u4e00\u6587\u4ef6\u65f6\uff0c\u7a0b\u5e8f\u53ea\u8c03\u7528\u4e00\u6b21<\/p>\n<p><strong>require( )<\/strong><\/p>\n<p>require()\u4e0e include()\u7684\u533a\u522b\u5728\u4e8e require()\u6267\u884c\u5982\u679c\u53d1\u751f\u9519\u8bef\uff0c\u51fd\u6570\u4f1a\u8f93\u51fa<\/p>\n<p>\u9519\u8bef\u4fe1\u606f\uff0c\u5e76\u7ec8\u6b62\u811a\u672c\u7684\u8fd0\u884c\u3002<\/p>\n<p><strong>require_once( )<\/strong><\/p>\n<p>\u529f\u80fd\u4e0e require()\u76f8\u540c\uff0c\u533a\u522b\u5728\u4e8e\u5f53\u91cd\u590d\u8c03\u7528\u540c\u4e00\u6587\u4ef6\u65f6\uff0c\u7a0b\u5e8f\u53ea\u8c03\u7528\u4e00\u6b21\u3002<\/p><\/blockquote>\n<h1 id=\"7%E3%80%81readfile()%EF%BC%9A\">7\u3001readfile()\uff1a<\/h1>\n<p>\u8bfb\u53d6\u4e00\u4e2a\u6587\u4ef6\uff0c\u5e76\u5199\u5165\u5230\u8f93\u51fa\u7f13\u51b2<\/p>\n<p><strong>\u7279\u6027\uff1a<\/strong>\u5373\u4f7f\u8def\u5f84\u4e2d\u7684\u5934\u76ee\u5f55\u4e0d\u5b58\u5728\uff0c\u4e5f\u53ef\u4ee5\u6b63\u786e\u8bfb\u53d6\u76ee\u6807\u6587\u4ef6<\/p>\n<p><strong>\u4f8b\u5982\uff1a<\/strong> hint.php?\/..\/..\/..\/flag.php<\/p>\n<p>\u548cinclude\u76f8\u4f3c<\/p>\n<h1 id=\"8%E3%80%81call_user_func()%EF%BC%9A\">8\u3001call_user_func()\uff1a<\/h1>\n<p>\u56de\u8c03\u51fd\u6570\uff0c<strong>call_user_func(a,b,...)\u00a0 <\/strong>a\u4e3a\u8981\u6267\u884c\u7684\u51fd\u6570\u540d\uff0c\u5269\u4e0b\u7684\u90fd\u4e3aa\u7684\u53c2\u6570\uff0c\u53ef\u4ee5\u6ca1\u6709<\/p>\n<p>\u8fd4\u56de\u503c\u4e3a\u5c06\u53c2\u6570\u5e26\u5165a\u51fd\u6570\u7684\u6267\u884c\u7ed3\u679c<\/p>\n<p>\u4f46\u8be5\u51fd\u6570\u8fd8\u53ef\u4ee5\u63a5\u53d7\u6570\u7ec4\u6765\u8c03\u7528\u7c7b\u4e2d\u7684\u9759\u6001\u65b9\u6cd5<\/p>\n<pre class=\"code\"> \u4f8b\u5982\uff1a\r\ncall_user_func($array);\r\n\u8c03\u7528classname\u8fd9\u4e2a\u7c7b\u91cc\u7684sya_hello\u65b9\u6cd5\r\n\r\narray[0]=$classname \u7c7b\u540d\r\narray[1]=say_hello say_hello()\u9759\u6001\u65b9\u6cd5<\/pre>\n<h1 id=\"9%E3%80%81trim()%3A\">9\u3001trim():<\/h1>\n<p>\u8be5\u51fd\u6570\u4f1a\u79fb\u9664\u53d8\u91cf\u4e2d\u7684<\/p>\n<ul>\n<li>\"\\0\" - NULL<\/li>\n<li>\"\\t\" - \u5236\u8868\u7b26<\/li>\n<li>\"\\n\" - \u6362\u884c<\/li>\n<li>\"\\x0B\" - \u5782\u76f4\u5236\u8868\u7b26<\/li>\n<li>\"\\r\" - \u56de\u8f66<\/li>\n<li>\" \" - \u7a7a\u683c<\/li>\n<\/ul>\n<p><strong>\u4f46\u4e0d\u4f1a\u79fb\u9664 \\f \u6362\u9875\u7b26\uff0cASCII\u503c\u4e3a12 url\u7f16\u7801\u4e3a%0c<\/strong><\/p>\n<h1 id=\"10%E3%80%81is_number()%3A\">10\u3001is_number():<\/h1>\n<p>\u5224\u65ad\u53d8\u91cf\u662f\u5426\u4e3a\u7eaf\u6570\u5b57\uff0c\u4f46\u53d8\u91cf\u5f00\u5934<strong>\u6709\u975e\u6253\u5370\u5b57\u7b26<\/strong>\uff08\u5982\\f \\n)\u4ecd\u4f1a\u8bc6\u522b\u4e3a\u6570\u5b57<\/p>\n<h1 id=\"11%E3%80%81extract()%EF%BC%9A\">11\u3001extract()\uff1a<\/h1>\n<p>\u5c06\u6570\u7ec4\u53d8\u91cf\u4e2d\u7684\u952e\u548c\u952e\u503c\u8f6c\u5316\u4e3a\u53d8\u91cf\u540d\u548c\u53d8\u91cf\uff0c\u5982\u679c\u6709\u51b2\u7a81\uff0c<strong>\u5219\u8986\u76d6\u5df2\u6709\u7684\u53d8\u91cf<\/strong><\/p>\n<pre class=\"code\"> \u4f8b\u5b50\uff1a\r\n&lt;?php\r\n$a = \"Original\";\r\n$my_array = array(\"a\" =&gt; \"Cat\",\"b\" =&gt; \"Dog\", \"c\" =&gt; \"Horse\");\r\nextract($my_array);\r\necho \"\\$a = $a; \\$b = $b; \\$c = $c\";\r\n?&gt;\r\n\/\/ $a=Cat;$b=Dog;$c=Horse<\/pre>\n<h1 id=\"12%E3%80%81parse_str()%3A\">12\u3001parse_str():<\/h1>\n<p>\u51fd\u6570\u628a\u67e5\u8be2\u5b57\u7b26\u4e32<strong>(\u4f8b\u5982\u8fd9\u79cd\uff1a<em>name=Peter&amp;age=43<\/em>)<\/strong>\u89e3\u6790\u5230\u53d8\u91cf\u4e2d<\/p>\n<p>\u683c\u5f0f\uff1a<strong> parse_str(string,array) <\/strong><\/p>\n<p>array\u53ef\u9009\uff08\u89c4\u5b9a\u5b58\u50a8\u53d8\u91cf\u7684\u6570\u7ec4\u540d\u79f0\uff0c\u8be5\u53c2\u6570\u6307\u793a\u53d8\u91cf\u5b58\u50a8\u5230\u6570\u7ec4\u4e2d\uff09<\/p>\n<p>\u5982\u679c\u4e0d\u8bbe\u7f6earray\u53c2\u6570\uff0c\u5c06\u4f1a<strong>\u8986\u76d6\u540c\u540d\u53d8\u91cf<\/strong><\/p>\n<pre class=\"code\"> \u4f8b\u5982\uff1a\r\n&lt;?php\r\nparse_str(\"name=Peter&amp;age=43\");\r\necho $name.\"&lt;br&gt;\";\r\necho $age;\r\n?&gt;\r\n\/\/ Peter\r\n43<\/pre>\n<h1 id=\"13%E3%80%81get_defined_vars()%EF%BC%9A\">13\u3001get_defined_vars()\uff1a<\/h1>\n<p>\u8fd4\u56de\u7531\u6240\u6709\u5df2\u5b9a\u4e49\u53d8\u91cf\u6240\u7ec4\u6210\u7684\u6570\u7ec4<\/p>\n<p>\u53ef\u914d\u5408 var_dump\u4f7f\u7528<\/p>\n<h1 id=\"14%E3%80%81gettext()%3A\">14\u3001gettext():<\/h1>\n<p>gettext() \u51fd\u6570\u7684\u5de5\u4f5c\u539f\u7406\u662f\uff0c\u5728\u7ffb\u8bd1\u524d\uff0c\u9700\u8981\u4f7f\u7528 <strong>gettext() \u51fd\u6570<\/strong>\u5c06\u8981\u7ffb\u8bd1\u7684\u6587\u672c\u5b57\u7b26\u4e32<strong>\u6807\u8bb0<\/strong>\u4e3a\u53ef\u7ffb\u8bd1\u5b57\u7b26\u4e32\uff0c\u7136\u540e\u73af\u5883\u4e2d\u662f\u4ec0\u4e48\u8bed\u8a00\uff0c\u5c31\u4f1a\u8f93\u51fa\u76f8\u5e94\u8bed\u8a00\u7684\u7ffb\u8bd1\uff0c\u8be5\u51fd\u6570\u53ef\u7528\u4e8e<strong>\u51d1\u6570<\/strong><\/p>\n<blockquote><p>_()\u662fgettext()\u7684\u62d3\u5c55\u51fd\u6570\u5728\u5f00\u542f\u76f8\u5173\u8bbe\u5b9a\u540e\uff0c_(\"666\")\u7b49\u4ef7\u4e8egettext(\"666\")<\/p><\/blockquote>\n<pre class=\"code\"> &lt;?php\r\necho gettext(666); \/\/\u8f93\u51fa 666\r\necho \"\\n\";\r\necho _(\"666\"); \/\/\u8f93\u51fa 666\r\n?&gt;<\/pre>\n<h1 id=\"15%E3%80%81%E5%8C%BF%E5%90%8D%E5%87%BD%E6%95%B0(create_function)%EF%BC%9A\">15\u3001\u533f\u540d\u51fd\u6570(create_function)\uff1a<\/h1>\n<p>php\u91cc<strong>\u9ed8\u8ba4\u547d\u540d\u7a7a\u95f4\u662f\\<\/strong>\uff0c\u6240\u6709\u539f\u751f\u51fd\u6570\u548c\u7c7b\u90fd\u5728\u8fd9\u4e2a\u547d\u540d\u7a7a\u95f4\u4e2d<\/p>\n<p>\u8c03\u7528\u8be5\u51fd\u6570\u9700\u8981\u524d\u9762\u52a0\u659c\u6760 <strong>\/create_function()<\/strong><\/p>\n<p><strong>\u8be5\u51fd\u6570\u5185\u90e8\u6784\u9020\u7c7b\u4f3c\u4e8e<\/strong><\/p>\n<pre class=\"code\"> function fT(,$a) {\r\necho \"test\".$a;\r\n}<\/pre>\n<p>\u8be5\u51fd\u6570\u4e0d\u9700\u8981\u7b2c\u4e00\u4e2a\u53c2\u6570\uff0c\u5e76\u53ef\u6dfb\u52a0\u7b2c\u4e8c\u4e2a\u53c2\u6570\uff0c\u53ef\u7528\u4e8e\u6784\u9020\u95ed\u5408<\/p>\n<p>\u8be5\u51fd\u6570\u81ea<strong>PHP 7.2<\/strong>\u8d77\u5df2\u7ecf\u5f03\u7528<\/p>\n<h1 id=\"16%E3%80%81%24_SERVER%5B'argv'%5D%3A\">16\u3001$_SERVER['argv']:<\/h1>\n<pre class=\"code\"> $_SERVER['argv']\uff1a\r\n\r\n1\u3001cli\u6a21\u5f0f\uff08\u547d\u4ee4\u884c\uff09\u4e0b\r\n\r\n\u7b2c\u4e00\u4e2a\u53c2\u6570$_SERVER['argv'][0]\u662f\u811a\u672c\u540d\uff0c\u5176\u4f59\u7684\u662f\u4f20\u9012\u7ed9\u811a\u672c\u7684\u53c2\u6570\r\n\r\n2\u3001web\u7f51\u9875\u6a21\u5f0f\u4e0b\r\n\r\n\u5728web\u9875\u6a21\u5f0f\u4e0b\u5fc5\u987b\u5728php.ini\u5f00\u542fregister_argc_argv\u914d\u7f6e\u9879\r\n\r\n\u8bbe\u7f6eregister_argc_argv = On(\u9ed8\u8ba4\u662fOff)\uff0c\u91cd\u542f\u670d\u52a1\uff0c$_SERVER[\u2018argv\u2019]\u624d\u4f1a\u6709\u6548\u679c\r\n\r\n\u8fd9\u65f6\u5019\u7684$_SERVER[\u2018argv\u2019][0] = $_SERVER[\u2018QUERY_STRING\u2019] \u6b64\u53d8\u91cf\u4e3aURL\u95ee\u53f7\u540e\u9762\u7684\u6240\u6709\u503c\r\n\r\n$argv,$argc\u5728web\u6a21\u5f0f\u4e0b\u4e0d\u9002\u7528<\/pre>\n<h1 id=\"17%E3%80%81%E5%93%88%E5%B8%8C%E5%87%BD%E6%95%B0%EF%BC%9A\">17\u3001\u54c8\u5e0c\u51fd\u6570\uff1a<\/h1>\n<p>\u54c8\u5e0c\u51fd\u6570\uff08sha1\uff0cmd5\u7b49\uff09\uff0c\u65e0\u6cd5\u5904\u7406\u6570\u7ec4\uff0c\u82e5\u5904\u7406\uff0c\u4f1a\u8fd4\u56deNULL\uff0c\u53ef\u7528\u4e8e===\u5f3a\u6bd4\u8f83<\/p>\n<h1 id=\"18%E3%80%81%E5%91%BD%E4%BB%A4%E6%89%A7%E8%A1%8C%E5%87%BD%E6%95%B0%EF%BC%9A\">18\u3001\u547d\u4ee4\u6267\u884c\u51fd\u6570\uff1a<\/h1>\n<h2 id=\"%E6%9C%89%E5%9B%9E%E6%98%BE%EF%BC%9A\">\u6709\u56de\u663e\uff1a<\/h2>\n<p><strong>system()<\/strong><\/p>\n<p><strong>passthru()<\/strong><\/p>\n<h2 id=\"%E6%97%A0%E5%9B%9E%E6%98%BE%EF%BC%9A\">\u65e0\u56de\u663e\uff1a<\/h2>\n<p><strong>exec()<\/strong><\/p>\n<p><strong>shell_exec()\u00a0 <\/strong>\u6216\u8005<strong>``<\/strong> \u53cd\u5f15\u53f7<\/p>\n<blockquote><p>\u65e0\u56de\u663e\u51fd\u6570\u9700\u8981\u6dfb\u52a0<strong>echo<\/strong>\u00a0 \u8f93\u51fa exec\u53ea\u8fd4\u56de<strong>\u6700\u540e\u4e00\u884c\u5185\u5bb9<\/strong> \uff0cshell_exec()<strong>\u8fd4\u56de\u5b8c\u6574\u5185\u5bb9<\/strong><\/p>\n<p>\u5728\u9898\u76ee\u4e2d\u5982\u679c\u6ca1\u6709echo\u7684\u8bdd\uff0c\u9700\u8981\u5229\u7528curl\u6765\u5b9e\u73b0flag.php\u7684\u5916\u5e26<\/p><\/blockquote>\n<h1 id=\"19%E3%80%81%E5%85%A8%E5%B1%80%E5%8F%98%E9%87%8F%EF%BC%9A\">19\u3001\u5168\u5c40\u53d8\u91cf\uff1a<\/h1>\n<p><strong>$GLOBALS<\/strong>\u6240\u6709\u5df2\u5b9a\u4e49\u7684\u53d8\u91cf\u90fd\u5728\u6b64\u53d8\u91cf\u6570\u7ec4\u91cc\u5b58\u50a8<\/p>\n<p><strong>var_dump($GLOBALS) <\/strong>\u53ef\u67e5\u770b\u6240\u6709\u7684\u53d8\u91cf\u4fe1\u606f<\/p>\n<h1 id=\"20%E3%80%81%E8%87%AA%E5%A2%9E%E7%BB%95%E8%BF%87%EF%BC%9A\">20\u3001\u81ea\u589e\u7ed5\u8fc7\uff1a<\/h1>\n<p><strong>payload\uff1a<\/strong><\/p>\n<pre class=\"code\"> code=$=(\/.);$=$[''!=''];$%ff=%2b%2b$;$%ff=%2b%2b$.$%ff;$%2b%2b;$%2b%2b;$%ff.=%2b%2b$;$%ff.=%2b%2b$;$=.$%ff;$$_;&amp;=system&amp;__=cat \/flag<\/pre>\n<h1 id=\"21%E3%80%81%E8%BF%9D%E8%A7%84%E5%8F%98%E9%87%8F%E5%90%8D%EF%BC%9A\">21\u3001\u8fdd\u89c4\u53d8\u91cf\u540d\uff1a<\/h1>\n<p>PHP\u53d8\u91cf\u540d\u7531\u6570\u5b57\u5b57\u6bcd\u4e0b\u5212\u7ebf\u7ec4\u6210\uff0cGET\u6216POST\u65b9\u5f0f\u4f20\u8fdb\u53bb\u7684\u53d8\u91cf\u540d\uff0c\u4f1a\u81ea\u52a8\u5c06\u7a7a\u683c + . [\u8f6c\u6362\u4e3a_<\/p>\n<p>\u6709\u4e00\u79cd\u7279\u6b8a\u60c5\u51b5\uff0cGET\u6216POST\u65b9\u5f0f\u4f20\u53c2\u65f6,\u53d8\u91cf\u540d\u4e2d\u7684 <strong>[<\/strong> \u4e5f\u4f1a\u88ab\u66ff\u6362\u4e3a<strong>_<\/strong>,<strong>\u4f46\u5176\u540e\u7684\u5b57\u7b26\u5c31\u4e0d\u518d\u8fdb\u884c\u66ff\u6362\u4e86<\/strong><\/p>\n<p>\u5982 <strong>CTF[SHOW.COM = CTF_SHOW.COM<\/strong><\/p>\n<h1 id=\"22%E3%80%81%E6%97%A0%E6%B3%95%E5%A4%84%E7%90%86%E6%95%B0%E7%BB%84%E7%9A%84%E5%87%BD%E6%95%B0%EF%BC%9A\">22\u3001\u65e0\u6cd5\u5904\u7406\u6570\u7ec4\u7684\u51fd\u6570\uff1a<\/h1>\n<pre class=\"code\"> md5() \u8fd4\u56deNULL\r\n\r\nsha1() \u8fd4\u56deNULL\r\n\r\npreg_match() \u8fd4\u56defalse\r\n\r\nintval() \u975e\u7a7a\u6570\u7ec4\u8fd4\u56de1\uff0c\u7a7a\u6570\u7ec4\u8fd4\u56de0\r\n\r\nstripos() \u8fd4\u56deNULL\r\n\r\nstrcmp() \u8fd4\u56de0<\/pre>\n<h1 id=\"23%E3%80%81%E5%91%BD%E4%BB%A4%E8%BF%90%E7%AE%97%EF%BC%9A\">23\u3001\u547d\u4ee4\u8fd0\u7b97\uff1a<\/h1>\n<p>php\u91cc\u6570\u5b57\u53ef\u4ee5\u548c\u547d\u4ee4\u53ef\u4ee5\u8fdb\u884c\u8fd0\u7b97\uff0c\u4e14\u4e0d\u5f71\u54cd\u8fd0\u884c\u7ed3\u679c<\/p>\n<p>\u5e76\u4e14\u4e5f\u53ef\u4ee5\u4f7f\u7528\u4f4d\u8fd0\u7b97\u7b26 |\uff0c\u6216\u4e09\u76ee\u8fd0\u7b97\u7b26<\/p>\n<h2 id=\"%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A0%C2%A024%E3%80%81%E5%8A%A0%E5%87%8F%E4%B9%98%E9%99%A4%E8%BF%90%E7%AE%97%E7%AC%A6%EF%BC%9A\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a024\u3001\u52a0\u51cf\u4e58\u9664\u8fd0\u7b97\u7b26\uff1a<\/h2>\n<pre class=\"code\"> &lt;?php\r\n$v1=1;\r\n$v2=3;\r\n$v3=-phpinfo();+ (url\u7f16\u7801)\r\n$code = eval(\"return $v1$v3$v2;\");\r\necho \"$v1$v3$v2 = \".$code;\r\n?&gt;<\/pre>\n<p>&nbsp;<\/p>\n<h2>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 25\u3001 \u4f4d\u8fd0\u7b97\u7b26\uff1a<\/h2>\n<pre class=\"code\"> &lt;?php\r\n$v1=1;\r\n$v2=3;\r\n$v3=|phpinfo();| (url\u7f16\u7801)\r\n$code = eval(\"return $v1$v3$v2;\");\r\necho \"$v1$v3$v2 = \".$code;\r\n?&gt;<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h2>\u00a0\u00a0\u00a0\u00a0\u00a0 26\u3001\u4e09\u76ee\u8fd0\u7b97\u7b26\uff1a<\/h2>\n<pre class=\"code\"> &lt;?php\r\n$v1=1;\r\n$v2=?phpinfo():;\r\n$v3=1;\r\neval(\"return $v1$v2$v3;'\");\r\n&gt;<\/pre>\n<h1 id=\"27%E3%80%81PHP%E4%BB%A3%E7%A0%81%E8%A1%A8%E7%A4%BA%E6%96%B9%E5%BC%8F%EF%BC%9A\">27\u3001PHP\u4ee3\u7801\u8868\u793a\u65b9\u5f0f\uff1a<\/h1>\n<h2 id=\"1%E3%80%81%E6%AD%A3%E5%B8%B8%E5%86%99%E6%B3%95xml%E6%A0%BC%E5%BC%8F\">1\u3001\u6b63\u5e38\u5199\u6cd5xml\u683c\u5f0f<\/h2>\n<pre class=\"code\"> &lt;?php\r\necho '1111';\r\n?&gt;<\/pre>\n<h2>2\u3001\u77ed\u6807\u7b7e<\/h2>\n<pre class=\"code\"> &lt;?\r\necho '1111';\r\n?&gt;\r\n\r\n&lt;?= \/\/\u76f8\u5f53\u4e8e&lt;? echo\r\n?&gt;<\/pre>\n<blockquote><p>\u9700\u8981 php.ini \u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u6307\u4ee4 short_open_tag \u6253\u5f00\u540e\u624d\u53ef\u7528\uff0c\u6216\u8005\u5728 PHP \u7f16\u8bd1\u65f6\u52a0\u5165\u4e86 --enable-short-tags \u9009\u9879\u3002\u81ea PHP5.4 \u8d77\uff0c\u77ed\u683c\u5f0f\u7684 echo \u6807\u8bb0 &lt;?= \u603b\u4f1a\u88ab\u8bc6\u522b\u5e76\u4e14\u5408\u6cd5\uff0c\u800c\u4e0d\u7ba1 short_open_tag \u7684\u8bbe\u7f6e\u662f\u4ec0\u4e48<\/p><\/blockquote>\n<h2>3\u3001asp\u98ce\u683c\u5199\u6cd5<\/h2>\n<pre class=\"code\"> &lt;%\r\necho '1111';\r\n%&gt;<\/pre>\n<blockquote><p>(\u6ce8\u610f\uff1a\u8fd9\u79cd\u5199\u6cd5\u5728php\u914d\u7f6e\u4e2d\u9ed8\u8ba4\u5173\u95ed\u4e86\u7684,\u5982\u679c\u8981\u6b63\u5e38\u8f93\u51fa\uff0c\u9700\u8981\u914d\u7f6ephp.ini\u6587\u4ef6\u3002\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u627e\u5230asp_tags=off ,\u5c06off\u6539\u4e3aon\u3002\u6539\u52a8\u914d\u7f6e\u6587\u4ef6\u540e\u9700\u8981\u91cd\u542fapache\u3002)\u4f46\u662f\u5728php7\u4e4b\u540e\u88ab\u79fb\u9664\u4e86<\/p><\/blockquote>\n<h2>4\u3001\u957f\u6807\u7b7e\u98ce\u683c<\/h2>\n<pre class=\"code\"> &lt;script language=\"php\"&gt;\r\n\r\n\r\n\r\n&lt;\/script&gt;\r\n\r\n\u5728php7\u4e4b\u540e\u88ab\u79fb\u9664\u4e86<\/pre>\n<h1>28\u3001\u677e\u6563\u6bd4\u8f83\uff1a<\/h1>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/blog.byzhb.top\/wp-content\/uploads\/2023\/01\/04ac74dbffdf4e78b8c6edaea7527189.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-194 size-full\" data-original=\"https:\/\/blog.byzhb.top\/wp-content\/uploads\/2023\/01\/04ac74dbffdf4e78b8c6edaea7527189.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" width=\"1522\" height=\"888\"  sizes=\"auto, (max-width: 1522px) 100vw, 1522px\" \/><\/div><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5e38\u89c1\u7684PHP\u7279\u6027\uff08bug\uff09\u603b\u7ed3\uff0c\u5e72\u8d27\u6ee1\u6ee1\u54e6<\/p>\n","protected":false},"author":1,"featured_media":96,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,1],"tags":[15,7,16],"class_list":["post-95","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ctf","category-uncategorized","tag-ctf","tag-php","tag-16"],"_links":{"self":[{"href":"https:\/\/blog.byzhb.top\/index.php\/wp-json\/wp\/v2\/posts\/95","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.byzhb.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.byzhb.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.byzhb.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.byzhb.top\/index.php\/wp-json\/wp\/v2\/comments?post=95"}],"version-history":[{"count":14,"href":"https:\/\/blog.byzhb.top\/index.php\/wp-json\/wp\/v2\/posts\/95\/revisions"}],"predecessor-version":[{"id":195,"href":"https:\/\/blog.byzhb.top\/index.php\/wp-json\/wp\/v2\/posts\/95\/revisions\/195"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.byzhb.top\/index.php\/wp-json\/wp\/v2\/media\/96"}],"wp:attachment":[{"href":"https:\/\/blog.byzhb.top\/index.php\/wp-json\/wp\/v2\/media?parent=95"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.byzhb.top\/index.php\/wp-json\/wp\/v2\/categories?post=95"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.byzhb.top\/index.php\/wp-json\/wp\/v2\/tags?post=95"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}