[MRCTF2020]Ez_bypass

又是一题绕过,这题只考了两种绕过,一个是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传参传入了两个参数,一个是gg,一个是id

一看是三个等号,既比较类型,又比较大小,可知是md5强碰撞,只要用数组过滤就好了

构造payload:?gg[]=1&id[]=2

由回显的最后一句可知,成功绕过第一层,接着第二层POST传参

is_numeric()函数用1234567a绕。1234567a是字符串,但是弱比较的时候,1在前,php会将其整体转成数字,就可以通过比较了。

于是传入参数passwd=1234567a执行得到flag

 

 

posted @ 2021-10-30 19:59  Athena-ydy  阅读(162)  评论(0)    收藏  举报