[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

相关推荐
mewowaBc1 天前
postman使用细则
测试工具·postman·偏差
洋不写bug4 天前
HTTP(二):万字解析HTTP交互的请求、响应报文格式
网络协议·http·交互·postman·请求格式·响应格式·restful规范
weihubeats12 天前
10 MB 的 Postman 替代品,启动不到 1 秒
测试工具·postman
菜鸟阿达18 天前
Postman 有哪些免费/开源的替代品?2026 年接口工具选型参考
测试工具·开源·postman
菜鸟阿达18 天前
我把 API 调试工具做成了浏览器版“Postman“,开源了:HTTP/SSE/WebSocket 全能测
http·开源·postman
Madison-No721 天前
多语言聊天大模型--测试报告
linux·git·python·selenium·jmeter·自动化·postman
ysu_03141 个月前
Postman接口调试实战指南-从HTTP请求到环境变量-Collection与自动化测试
网络·网络协议·测试工具·http·api·postman·可用性测试
开开心心_Every1 个月前
文件夹批量创建工具支持同级和多层级
运维·服务器·游戏·jupyter·智能手机·pdf·postman
花间相见1 个月前
【计算基础|网络04】—— HTTP接口实战(下):接口测试、鉴权与跨域排错
java·linux·人工智能·后端·python·计算机网络·postman
Madison-No71 个月前
基于JMeter工具的性能测试(接口)
python·jmeter·postman