[MRCTF2020]Ez_bypass --BUUCTF

打开连接

emmm,认真观察发现这些是php代码,复制粘贴整理一下得到

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');
}

接下来审计php代码,md5函数有个不足之处就是当传入的参数是数组时,会返回false,所以这里构建payload,get传参

?id[]=1&gg[]=2

接下来根据PHP特性,进行比较的时候,会先转化为同类型再进行比较,比如

if('1562adsfa' > 111)

会先转化为

if(1562 > 111)

再进行比较

所以我们可以post传参 ,构建payload

passwd=1234567abc

用hackbar传参 

[MRCTF2020]Ez_bypass --BUUCTF_第1张图片

 拿到flag

你可能感兴趣的:(CTFのWriteUp,CTF)