当前位置:网站首页>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 绕过
边栏推荐
- web安全与防御
- [staff] common symbols of staff (Hualian clef | treble clef | bass clef | rest | bar line)
- Amq6126 problem solving ideas
- Statistical learning methods - Chapter 5, decision tree model and learning (Part 1)
- [staff] the lines and spaces of the staff (the nth line and the nth space in the staff | the plus N line and the plus N space on the staff | the plus N line and the plus N space below the staff | the
- [go practical basis] how to install and use gin
- Difference between redis serialization genericjackson2jsonredisserializer and jackson2jsonredisserializer
- Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedd
- 机器学习实战:《美人鱼》属于爱情片还是动作片?KNN揭晓答案
- Oracle modifies tablespace names and data files
猜你喜欢

Typora安装包分享

个人经历&&博客现状

Mysql默认事务隔离级别及行锁

Statistical learning methods - Chapter 5, decision tree model and learning (Part 1)

洞见云原生|微服务及微服务架构浅析

The channel cannot be viewed when the queue manager is running

Watermelon book -- Chapter 5 neural network

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

Timed thread pool implements request merging

微服务实战|Eureka注册中心及集群搭建
随机推荐
深入剖析JVM是如何执行Hello World的
MySQL multi column in operation
聊聊消息队列高性能的秘密——零拷贝技术
西瓜书--第五章.神经网络
web安全与防御
View the port of the application published by was
[staff] time sign and note duration (full note | half note | quarter note | eighth note | sixteenth note | thirty second note)
Typora安装包分享
告别996,IDEA中必装插件有哪些?
Pdf document of distributed service architecture: principle + Design + practice, (collect and see again)
I've taken it. MySQL table 500W rows, but someone doesn't partition it?
在SQL注入中,为什么union联合查询,id必须等于0
Matplotlib剑客行——布局指南与多图实现(更新)
Talk about the secret of high performance of message queue -- zero copy technology
[staff] common symbols of staff (Hualian clef | treble clef | bass clef | rest | bar line)
Long summary (code with comments) number structure (C language) -- Chapter 4, string (Part 1)
微服务实战|声明式服务调用OpenFeign实践
长篇总结(代码有注释)数构(C语言)——第四章、串(上)
数构(C语言)——第四章、矩阵的压缩存储(下)
Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedd