当前位置:网站首页>BugkuCTF-web16(备份是个好习惯)
BugkuCTF-web16(备份是个好习惯)
2022-07-02 06:34:00 【hangshao0.0】
解题要点
使用御剑、dirmap 或者 dirsearch 等扫描工具,扫除备份文件所在位置
打开备份文件,代码如下:
<?php /** * Created by PhpStorm. * User: Norse * Date: 2017/8/6 * Time: 20:22 */ include_once "flag.php"; ini_set("display_errors", 0); $str = strstr($_SERVER['REQUEST_URI'], '?'); $str = substr($str,1); $str = str_replace('key','',$str); parse_str($str); echo md5($key1); echo md5($key2); if(md5($key1) == md5($key2) && $key1 !== $key2){ echo $flag."取得flag"; } ?>代码含义:
md5加密后,key1==key2,同时保证原来的key1!=key2
如何满足条件
- PHP有个隐式转换的缺陷,PHP在处理哈希字符串时,会利用”!=”或”==”来对哈希值进行比较,它把每一个以”0E”开头的哈希值都解释为0,所以如果两个不同的密码经过哈希以后,其哈希值都是以”0E”开头的,那么PHP将会认为他们相同,都是0
- md5无法处理数组,会把数组变为 null
如何构造条件
QNKCDZO和240610708在md5加密后,满足上述第一点的条件- 构造
?kekeyy1[]=1&kekeyy2[]=2,使NULL=NULL,但是两个参数本身并不相等,,满足上述第二点的条件
两种构造参数的方法均可获得flag:
/?kekeyy1=QNKCDZO&kekeyy2=240610708
/?kekeyy1[]=1&kekeyy2[]=2
使用参数 ?kekeyy 是因为php代码中有一个 replace 将 key 替换为空,所以构造 ?kekeyy 绕过
边栏推荐
- 别找了,Chrome浏览器必装插件都在这了
- Redis sorted set data type API and application scenario analysis
- 个人经历&&博客现状
- Programmers with ten years of development experience tell you, what core competitiveness do you lack?
- 记录下对游戏主机配置的个人理解与心得
- Matplotlib swordsman Tour - an artist tutorial to accommodate all rivers
- Enterprise level SaaS CRM implementation
- Redis installation and deployment (windows/linux)
- Mathematics in machine learning -- point estimation (I): basic knowledge
- DTM distributed transaction manager PHP collaboration client V0.1 beta release!!!
猜你喜欢

Redis installation and deployment (windows/linux)

Matplotlib剑客行——容纳百川的艺术家教程

idea查看字节码配置
![[go practical basis] how to bind and use URL parameters in gin](/img/63/84717b0da3a55d7fda9d57c8da2463.png)
[go practical basis] how to bind and use URL parameters in gin

Microservice practice | Eureka registration center and cluster construction

告别996,IDEA中必装插件有哪些?

I've taken it. MySQL table 500W rows, but someone doesn't partition it?

Ora-12514 problem solving method
![[go practical basis] how to verify request parameters in gin](/img/de/50db131d6993e5d955e3416c667c4c.png)
[go practical basis] how to verify request parameters in gin

微服务实战|Eureka注册中心及集群搭建
随机推荐
DTM distributed transaction manager PHP collaboration client V0.1 beta release!!!
Operation and application of stack and queue
Redis installation and deployment (windows/linux)
Chrome browser tag management plug-in – onetab
web安全与防御
长篇总结(代码有注释)数构(C语言)——第四章、串(上)
Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedd
Activity的创建和跳转
在SQL注入中,为什么union联合查询,id必须等于0
VIM operation command Encyclopedia
"Interview high frequency question" is 1.5/5 difficult, and the classic "prefix and + dichotomy" application question
数构(C语言)——第四章、矩阵的压缩存储(下)
How to use pyqt5 to make a sensitive word detection tool
Don't look for it. All the necessary plug-ins for Chrome browser are here
Elastic Stack之Beats(Filebeat、Metricbeat)、Kibana、Logstash教程
[go practical basis] how can gin get the request parameters of get and post
Pdf document of distributed service architecture: principle + Design + practice, (collect and see again)
Watermelon book -- Chapter 5 neural network
机器学习实战:《美人鱼》属于爱情片还是动作片?KNN揭晓答案
Matplotlib剑客行——没有工具用代码也能画图的造型师