never give up

开卷看题

决不放弃?我怎么可能放弃呢

开始尝试

主页面会重定向添加id参数,BUT尝试修改数值发现没什么用

看看源码吧

注释自然是最显眼的,给出了一个文件名1p.html,尝试访问发现会重定向到bugku主站

开始套娃

根据数据包可以看到是通过JS实现重定向的,而且JS的内容还不少,拉出来URLdecode

可以看到是一段重定向和一段注释,对注释继续base64解码

再次进行URL解码之后得到了一段PHP代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
// 开头修改了一下,方便格式化源码,请忽略...

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) {
require("f4l2a3g.txt");
} else {
print "never never never give up !!!";
}

?>

总结一下:当程序满足一大堆条件之后就会包含f4l2a3g.txt文件,此刻有没有意识到什么?对,txt文件是直接可以访问的(txt显示内容和原始内容相同,不会像PHP会被解析)

取得胜利

那么接下来就是重头戏了:访问f4l2a3g.txt获得通向未来的钥匙

拿下flag

后记

探寻捷径,可以更快的到达终点