0x01 Title Description
Look at the hint
look url
have file
a feel of what's possible to use pseudo-protocol, try the next, not a thing
to sweep through the catalog, find ./source.php
the source file
source code is as follows
<?php
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\" />";
}
?>
0x02 solution to a problem
Read the file contains, whether before checkFile $ _page function takes a file argument first question mark field and check the file name as the file parameter so configured whitelisthint.php?/../../../../../ffffllllaaaagggg
The principle is hint.php?/
treated as a directory, the directory after the jump like (this only applies to linux)
and the include
function is not the same mkdir
function, if there is no table of contents will error