[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

再覆盖覆盖handsome变量

handsome=flag,得到handsome=flag

?handsome=flag&flag=handsome

可以得到flag

相关推荐
坐吃山猪11 天前
Python22-PostMan调试MCP
测试工具·postman·mcp
光谱SpectrAI16 天前
打开 Postman 会改 Codex?Windows 上 4 处都没有
postman
yz_aiks16 天前
Postman 自动给 Claude Code、Codex、Cursor 装插件怎么查和卸载:本机实测 5 处痕迹(Postman 12.34)
安全·postman·ai编程·开发工具·claude code
mewowaBc21 天前
postman使用细则
测试工具·postman·偏差
洋不写bug24 天前
HTTP(二):万字解析HTTP交互的请求、响应报文格式
网络协议·http·交互·postman·请求格式·响应格式·restful规范
weihubeats1 个月前
10 MB 的 Postman 替代品,启动不到 1 秒
测试工具·postman
菜鸟阿达1 个月前
Postman 有哪些免费/开源的替代品?2026 年接口工具选型参考
测试工具·开源·postman
菜鸟阿达1 个月前
我把 API 调试工具做成了浏览器版“Postman“,开源了:HTTP/SSE/WebSocket 全能测
http·开源·postman
Madison-No71 个月前
多语言聊天大模型--测试报告
linux·git·python·selenium·jmeter·自动化·postman
ysu_03142 个月前
Postman接口调试实战指南-从HTTP请求到环境变量-Collection与自动化测试
网络·网络协议·测试工具·http·api·postman·可用性测试