[MRCTF2020]Ez_bypass--详细解析

[MRCTF2020]Ez_bypass

查看源码,并审计:

I put something in F12 for you
include 'flag.php';
$flag='MRCTF{xxxxxxxxxxxxxxxxxxxxxxxxx}';

//get传参 gg和id
if(isset($_GET['gg'])&&isset($_GET['id'])) { 
    $id=$_GET['id'];
    $gg=$_GET['gg'];
    
    //进行md5强类型比较,要求两个参数的值不相等并且md5编码后要相等
    if (md5($id) === md5($gg) && $id !== $gg) { 
        echo 'You got the first step';
        
        //POST传参 passwd
        if(isset($_POST['passwd'])) {
            $passwd=$_POST['passwd'];
            
            //passwd参数值不能是数字或者纯数字字符串
            if (!is_numeric($passwd))
            {
                 
                //如果passwd==1234567,则展示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');
}
}Please input first

对于强比较类型的md5,选择传入两个不同的数组绕过。

因为md5()函数传参数组时,会返回false,而false===false,成功绕过。

在这里插入图片描述

回显有:You got the first step,说明成功绕过。

传参passwd,不能是数字或者纯数字字符串,但是要passwd==1234567

可以传参passwd=1234567a,这样可以绕过is_numeric()的检测,而且在字符串与数字进行弱类型比较时,PHP会把数字开头的字符串转换为整数型,转换后的值为从首位数字开始到非数字位。成功绕过。

在这里插入图片描述

查看源码得到flag{6a4b9d45-a593-432c-8694-faf49c63d871}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值