• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

[MRCTF2020]Ez_bypass

武飞扬头像
coleak
帮助1

目录

信息收集

代码审计

第一个判断 

第二层判断

传参方式

补充说明


信息收集

打开靶场页面显示给出提示

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

代码如下 

  1.  
    <?php
  2.  
    include 'flag.php';
  3.  
    $flag='MRCTF{xxxxxxxxxxxxxxxxxxxxxxxxx}';
  4.  
    if(isset($_GET['gg'])&&isset($_GET['id'])) {
  5.  
    $id=$_GET['id'];
  6.  
    $gg=$_GET['gg'];
  7.  
    if (md5($id) === md5($gg) && $id !== $gg) {
  8.  
    echo 'You got the first step';
  9.  
    if(isset($_POST['passwd'])) {
  10.  
    $passwd=$_POST['passwd'];
  11.  
    if (!is_numeric($passwd))
  12.  
    {
  13.  
    if($passwd==1234567)
  14.  
    {
  15.  
    echo 'Good Job!';
  16.  
    highlight_file('flag.php');
  17.  
    die('By Retr_0');
  18.  
    }
  19.  
    else
  20.  
    {
  21.  
    echo "can you think twice??";
  22.  
    }
  23.  
    }
  24.  
    else{
  25.  
    echo 'You can not get it !';
  26.  
    }
  27.  
     
  28.  
    }
  29.  
    else{
  30.  
    die('only one way to get the flag');
  31.  
    }
  32.  
    }
  33.  
    else {
  34.  
    echo "You are not a real hacker!";
  35.  
    }
  36.  
    }
  37.  
    else{
  38.  
    die('Please input first');
  39.  
    }
  40.  
    }
  41.  
    ?>
学新通

代码审计

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

第一个判断 

payload

id[]=1&gg[]=2

第二层判断

php弱类型比较

php==在比较不同类型的数据时,会首先将==两边的数据转化为同一类型,字符型数据与数字型数据进行比较,字符型数据会转化为数据型数据。

需要passwd非数字且==1234567

payload

passwd=1234567coleak

传参方式

在 网址?id[]=1&gg[]=2页面通过post请求传入第二个payload

最后整合如下,同时进行get和post传参

学新通 拿到flag学新通

补充说明

md5(array()) = null
sha1(array()) = null    
ereg(pattern,array()) = null vs preg_match(pattern,array) = false
strcmp(array(), "abc") = null
strpos(array(),"abc") = null

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhgfjfcg
系列文章
更多 icon
同类精品
更多 icon
继续加载