[MRCTF2020]Ez_bypass 1

题目运用的知识点

  • 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

解题

代码审计题
可以看到题目需要我们传两个GET参数和一个POST参数
需要绕过两处:
(md5($id) === md5($gg) && $id !== $gg)=true
(!is_numeric($passwd) && $passwd==1234567)=true

第一处是一个MD5的绕过,我们构造PL/?id[]=1&gg[]=2
在这里插入图片描述
第二处有个is_numeric()函数,我们利用弱比较绕过,拿到FLAG
passwd=1234567a
在这里插入图片描述

关于MD5函数绕过思路

1.传md5值是0e开头的字符串,比如
QNKCDZO(0e830400451993494058024219903391) 和
s878926199a(0e545993274517709034328855841020)
因为php在利用”!=”或”==”来对哈希值进行比较,它把每一个以”0E”开头的哈希值都解释为0
2.传递数组 因为向md5函数传递数组会返回NULL

关于is_numeric()

is_numeric() 函数用于检测变量是否为数字或数字字符串。PHP 版本要求:PHP 4, PHP 5, PHP 7

语法
bool is_numeric ( mixed $var )
参数说明:

$var:要检测的变量。
返回值
如果指定的变量是数字和数字字符串则返回 TRUE,否则返回 FALSE,注意浮点型返回空值,即 FALSE。

  • 4
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值