BUUCTF [MRCTF2020]Ez_bypass 1

题目环境:
image.png
F12查看源代码
image.png

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 

PHP代码审计

分析源码关键点
获取flag的思路:
需要满足两个条件:
GET传参方式
- “===”;md5值强对比;id与gg的值不能相等;可通过数组并赋不同的值进行绕过。

POST传参方式

  - !is_numeric函数决定了passwd参数的值是数字或数字字符串,加个!就是相反的意思,如果passwd是数字字符串并等于1234567那么就会输出flag的值,如果不是那么就会进入else语句。

火狐浏览器传参
GET payload:
?id[]=1&gg[]=2
POST payload:
passwd=1234567a
image.png
得到flag:
flag{95c8f35d-4ce2-4ba8-a849-2bbd941a75ea}