[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

相关推荐
鱼鱼说测试2 天前
如何用Postman做接口自动化测试
测试工具·postman
瑞瑞绮绮2 天前
玩转PostMan之调试天气接口-心知天气 API
测试工具·postman
Codebill3 天前
API 响应体加密场景下的调试实践:Postman 的局限与 Apipost 的优化
postman·apipost·api调试
lichong9514 天前
API开发工具postman、国内xxapi和SmartApi的性能对比
eclipse·intellij-idea·api·postman·visual studio·apipost·apifox
小白编码4 天前
【postMan / apifox 文件上传】
测试工具·postman
测试老哥6 天前
6个步骤实现Postman接口压力测试
自动化测试·软件测试·测试工具·测试用例·接口测试·压力测试·postman
咕噜企业签名分发-淼淼6 天前
苹果TF签名全称TestFlight签名,需要怎么做才可以上架呢?
gulp
lichong95110 天前
【混合开发】Android+Webview+VUE播放视频之视频解析工具mediainfo-Macos
android·macos·架构·vue·音视频·api·postman
深兰科技11 天前
深兰科技AI问诊助手走访打浦桥街道社区卫生服务中心
人工智能·windows·github·postman·visual studio·深兰科技·ai问诊
cxyll123412 天前
postman 用于接口测试,举例
开发语言·lua·接口测试·postman