发现过程:
-
进入到页面只看到一张图片,这时有两种方式来发现代码
a. 进行目录扫描,发现可能存在的目录
b.F12 看html源码,在里面有提示source.php
,直接访问即可 -
看到代码后发现白名单里还有一个文件,尝试访问一下,能够得到flag所在的文件
-
flag·获取步骤如下:
<?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 . '?', '?')
);
//判断截取后得字符串在白名单中是否存在