• [MRCTF2020]Ez_bypass


    0x01

    打开页面首先可以得到的是一段php代码,进行代码美化以后放到PhpStorm中进行审计。

    还可以得到的就是页面上的一些提示信息:Please input first;总之先审一审代码。

    0x02

    第一部分

    先看代码的第一部分,也就是第一层if循环。这里要求的是通过get的方式传入两个参数id和gg。如果没有传入两个参数就会在页面上输出Please input first,也就和我们页面上的提示信息对应起来。还有就是包含了文件flag.php

    <?php
    include 'flag.php';
    $flag='MRCTF{i like u flag}';
    if(isset($_GET['gg'])&&isset($_GET['id'])) {
        $id=$_GET['id'];
        $gg=$_GET['gg'];
        // 通过get方式获取两个变量。id gg
           xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    } else {
        die('Please input first');
    }

    第二部分

    第二层if判断,在这层进行一个md5强碰撞,满足条件后会在页面输出You got the first step。否则我输出You are not a real hacker!

    这里进行的测试,先传递如id=1&gg=1可以看到页面上输出了You are not a real hacker!,继而进行下一步,传入两个值不同但MD之后的值相同的字符串。页面输出了You got the first step

    if (md5($id) === md5($gg) && $id !== $gg) {//md5 强碰撞
            echo 'You got the first step';
               xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
         } else {
            echo "You are not a real hacker!";
        }   
    id=M%C9h%FF%0E%E3%5C%20%95r%D4w%7Br%15%87%D3o%A7%B2%1B%DCV%B7J%3D%C0x%3E%7B%95%18%AF%BF%A2%00%A8%28K%F3n%8EKU%B3_Bu%93%D8Igm%A0%D1U%5D%83%60%FB_%07%FE%A2
    &
    gg=M%C9h%FF%0E%E3%5C%20%95r%D4w%7Br%15%87%D3o%A7%B2%1B%DCV%B7J%3D%C0x%3E%7B%95%18%AF%BF%A2%02%A8%28K%F3n%8EKU%B3_Bu%93%D8Igm%A0%D1%D5%5D%83%60%FB_%07%FE%A2

    第三部分

    这一部分要求通过post的方式获取一个参数passwd,后面的if判断中都是在对passwd进行判断。

    首先要求passwd不为空,其次是passwd必须不是一个数字,最后passwd==1234567

    很明显的,这里是一个php弱类型的问题哈,只需要post传入 passwd=1234567a即可满足判断语句,最后 highlight_file('flag.php');输出flag.php

     if(isset($_POST['passwd'])) {
                $passwd=$_POST['passwd'];
                //通过POST传入一个参数passwd ,并要求passwd不是数字,但是要求passwd==1234567
                //然后输出flag.php
                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');
            }

    0x03

    总结一下,这道题主要考察的点就是

    1.md5强碰撞

    2.php弱类型的比较

  • 相关阅读:
    js与jquery实时监听输入框值的oninput与onpropertychange方法
    jQuery实现的浮动层div浏览器居中显示效果
    jquery代码规范让代码越来越好看
    asp.net截屏功能实现截取web页面
    拦截asp.net输出流并进行处理的方法
    asp.net调用系统设置字体文本框的方法
    asp.net网站防恶意刷新的Cookies与Session解决方法
    Attribute在.net编程中的应用(一)
    java学习——构造类之3!+5!=126
    java学习——构造类
  • 原文地址:https://www.cnblogs.com/ersuani/p/14101356.html
Copyright © 2020-2023  润新知