BUUCTF | [MRCTF2020]Ez_bypass

题目

打开后查看源代码👇

I put something in F12 for you 
<?php 
include 'flag.php'; 
$flag='MRCTF{xxxxxxxxxxxxxxxxxxxxxxxxx}'; 
if(isset($_GET['gg'])&&isset($_GET['id'])) { // 传入两个GET,gg和id
    $id=$_GET['id']; 
    $gg=$_GET['gg']; 
    if (md5($id) === md5($gg) && $id !== $gg) { // 经过md5后两个值,全等,且传入的值不相同
        echo 'You got the first step'; 
        if(isset($_POST['passwd'])) {   // 传入POST,passwd
            $passwd=$_POST['passwd']; 
            if (!is_numeric($passwd)) { // 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

从上面的一串代码中可以看出我们需要满足以上五个if中的要求才可以的到flag.php中的flag

步骤

第一个if中的要求是传入两个GET,gg和id代码如下

http://daf2a17b-6222-42a6-8b8d-05ca00375fcb.node4.buuoj.cn/?id[]=1&gg[]=1

当我们传入两个值后网页显示了You are not a real hacker!

第二个if是要满足传入的id和gg的值不相同代码如下

http://1e8408b5-c290-475b-8442-eef04d2101b0.node4.buuoj.cn/?id[]=1&gg[]=2

传入两个不相同的值后显示You got the first steponly one way to get the flag,也就是满足第二个if但不满足第三个if的输出结果

第三个if是要满足传入一个post为passwd的值代码如下

http://1e8408b5-c290-475b-8442-eef04d2101b0.node4.buuoj.cn/?id[]=1&gg[]=2
passwd=111

传入passwd值后显示You got the first stepYou can not get it !这里说明我们满足了第三个if但是不满足第四个if

第四个if是要满足post传入的passwd的值不能为数字!为否定的意思代码如下

http://1e8408b5-c290-475b-8442-eef04d2101b0.node4.buuoj.cn/?id[]=1&gg[]=2
passwd=aaa

传入passwd的值aaa后显示You got the first stepcan you think twice??说明我们满足了第四个if但是没有满足第五个if

第五个if是要满足传入的passwd开头必须要带1234567这个值代码如下

http://1e8408b5-c290-475b-8442-eef04d2101b0.node4.buuoj.cn/?id[]=1&gg[]=2
passwd=1234567aaa

传入passwd的值为1234567aaa的时候我们就满足了第五个if所有我们得到了flag.php中的flag

最后我们得到了flag非常开心,这篇存手写感谢大家的支持,有问题可以评论或者私信我哦~

posted @ 2021-07-04 23:17  SpouseLJ  阅读(108)  评论(0编辑  收藏  举报