本文为记录个人信安小白的刷题路程,大佬勿喷,也同时希望文章能对您有所帮助

打开靶机,要进行代码审计

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
include 'flag.php';
$flag = 'MRCTF{xxxxxxxxxxxxxxxxxxxxxxxxx}';

if(isset($_GET['gg']) && isset($_GET['id'])) {
$id = $_GET['id'];
$gg = $_GET['gg'];

// 检查 $id 和 $gg 的 MD5 散列值是否相等,并且它们的值不相等,强比较
if (md5($id) === md5($gg) && $id !== $gg) {
echo 'You got the first step';

if(isset($_POST['passwd'])) {
// 获取 POST 参数 'passwd' 的值
$passwd = $_POST['passwd'];

// 检查 $passwd 是否为数字
if (!is_numeric($passwd)) {
// 如果 $passwd 等于 1234567,则输出 'Good Job!',显示 'flag.php' 的内容,然后终止脚本执行
if($passwd == 1234567) {
echo 'Good Job!';
highlight_file('flag.php');
die('By Retr_0');
} else {
echo "can you think twice??";
}
} else {
echo 'You can not get it !';
}
} else {
die('only one way to get the flag');
}
} else {
echo "You are not a real hacker!";
}
} else {
die('Please input first');
}

需要绕过两个比较,
第一个比较用数组绕过即可,

第二个比较数字后面加字母即可,

获得flag