打开页面看见一堆代码,
复制粘贴过来顺便:
I put something in F12 for you
include 'flag.php';
$flag='MRCTF{xxxxxxxxxxxxxxxxxxxxxxxxx}';
if(isset($_GET['gg'])&&isset($_GET['id'])) //判断是否传参
{
$id=$_GET['id'];
$gg=$_GET['gg']; //赋值
if (md5($id) === md5($gg) && $id !== $gg) {//使id与gg加密前不相等,加密后相等,注意这里是强比较。
echo 'You got the first step';
if(isset($_POST['passwd'])) {//判断是否传参
$passwd=$_POST['passwd']; //赋值
if (!is_numeric($passwd)) { //判断psaawd是否是数字或数字字符串,这里表示passwd不能是数字或数字字符串
if($passwd==1234567) { //判断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');
}
}
Please input first
进行代码审计如上。
因此构造payload
http://9dfb1c18-2411-4f8b-bcc1-8c40b523ab91.node4.buuoj.cn:81/?id[]=1&gg[]=2
页面出现了变化,继续向页面传参,由于上面必须使输入不能是纯数字,利用passwd与1234567比较的时候是弱类型比较,而我们知道,弱类型比较会先在比较前将比较的两边转化成同一种类型,
例如:
当 if(12s==12) 比较时,这里12s会被转化成12 ,故返回true。
因此继续构造payload:
得到结果: