当前位置:网站首页>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 绕过
边栏推荐
- [go practical basis] how to verify request parameters in gin
- Chrome视频下载插件–Video Downloader for Chrome
- Customize redis connection pool
- Alibaba /热门json解析开源项目 fastjson2
- I've taken it. MySQL table 500W rows, but someone doesn't partition it?
- Redis sorted set data type API and application scenario analysis
- Jingdong senior engineer has developed for ten years and compiled "core technology of 100 million traffic website architecture"
- 个人经历&&博客现状
- 《统计学习方法》——第五章、决策树模型与学习(上)
- Ora-12514 problem solving method
猜你喜欢
hystrix 实现请求合并
Activity的创建和跳转
MySQL multi column in operation
数构(C语言--代码有注释)——第二章、线性表(更新版)
聊聊消息队列高性能的秘密——零拷贝技术
Timed thread pool implements request merging
Actual combat of microservices | discovery and invocation of original ecosystem implementation services
Probability is not yet. Look at statistical learning methods -- Chapter 4, naive Bayesian method
Number structure (C language) -- Chapter 4, compressed storage of matrices (Part 2)
Chrome浏览器标签管理插件–OneTab
随机推荐
Statistical learning methods - Chapter 5, decision tree model and learning (Part 1)
Alibaba /热门json解析开源项目 fastjson2
Chrome video download Plug-in – video downloader for Chrome
[staff] time mark and note duration (staff time mark | full note rest | half note rest | quarter note rest | eighth note rest | sixteenth note rest | thirty second note rest)
zk配置中心---Config Toolkit配置与使用
"Interview high frequency question" is 1.5/5 difficult, and the classic "prefix and + dichotomy" application question
Microservice practice | Eureka registration center and cluster construction
Solution to amq4036 error in remote connection to IBM MQ
Chrome browser plug-in fatkun installation and introduction
每天睡前30分钟阅读Day6_Day6_Date_Calendar_LocalDate_TimeStamp_LocalTime
[go practical basis] how to verify request parameters in gin
企业级SaaS CRM实现
MySQL error: unblock with mysqladmin flush hosts
Microservice practice | declarative service invocation openfeign practice
大学生四六级作文模板(自创版,成功跨过六级)
Redis sorted set data type API and application scenario analysis
[go practical basis] how to bind and use URL parameters in gin
十年开发经验的程序员告诉你,你还缺少哪些核心竞争力?
Customize redis connection pool
Learn combinelatest through a practical example