[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

相关推荐
XXX-175 小时前
3.postman脚本语言、接口关联(json引用(变量)、脚本用正则表达式)、断言封装、自动化构造接口请求(Postman工具)
软件测试·接口测试·postman
假女吖☌1 天前
postman接口关联
测试工具·postman
讓丄帝愛伱1 天前
PostMan使用变量
测试工具·postman
MYPM_AndyLiu3 天前
Codes 开源研发项目管理平台——敏捷测试管理创新解决方案
jmeter·接口测试·postman·缺陷管理·testlink·测试用例管理·开源免费测试理平台
运维Z叔4 天前
利用shuji还原webpack打包源码
服务器·前端·webpack·node.js·postman·xss·csrf
 嘘 4 天前
程序员装新机
windows·vscode·postman·idea
HY_PIGIE8 天前
[Postman]接口自动化测试入门
前端·测试工具·postman
霍格沃兹测试开发学社测试人社区9 天前
软件测试学习笔记丨Postman基础使用
软件测试·笔记·测试开发·学习·postman
程序员威子10 天前
软件测试中的白盒测试,这些技巧你知道吗?
功能测试·测试工具·jmeter·单元测试·测试用例·压力测试·postman
程序员小雷10 天前
字节面试 | 如何测试RocketMQ、RocketMQ?
测试工具·面试·职场和发展·单元测试·测试用例·rocketmq·postman