当前位置:网站首页>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 绕过
边栏推荐
- 知识点很细(代码有注释)数构(C语言)——第三章、栈和队列
- Chrome用户脚本管理器-Tampermonkey 油猴
- Knowledge points are very detailed (code is annotated) number structure (C language) -- Chapter 3, stack and queue
- C语言之分草莓
- Complete solution of servlet: inheritance relationship, life cycle, container, request forwarding and redirection, etc
- 每天睡觉前30分钟阅读_day3_Files
- 双非本科生进大厂,而我还在底层默默地爬树(上)
- 在SQL注入中,为什么union联合查询,id必须等于0
- AMQ 4043 solution for errors when using IBM MQ remote connection
- 一篇详解带你再次重现《统计学习方法》——第二章、感知机模型
猜你喜欢

Cloudrev self built cloud disk practice, I said that no one can limit my capacity and speed

Talk about the secret of high performance of message queue -- zero copy technology
![[go practical basis] gin efficient artifact, how to bind parameters to structures](/img/c4/44b3bda826bd20757cc5afcc5d26a9.png)
[go practical basis] gin efficient artifact, how to bind parameters to structures

Cloudreve自建云盘实践,我说了没人能限制得了我的容量和速度

微服务实战|微服务网关Zuul入门与实战

京东面试官问:LEFT JOIN关联表中用ON还是WHERE跟条件有什么区别

Redis 序列化 GenericJackson2JsonRedisSerializer和Jackson2JsonRedisSerializer的区别

别找了,Chrome浏览器必装插件都在这了

Knowledge points are very detailed (code is annotated) number structure (C language) -- Chapter 3, stack and queue

微服务实战|熔断器Hystrix初体验
随机推荐
Microservice practice | fuse hytrix initial experience
Watermelon book -- Chapter 6 Support vector machine (SVM)
Microservice practice | teach you to develop load balancing components hand in hand
What is the function of laravel facade
CKEditor 4.10.1 上传图片提示“不正确的服务器响应” 问题解决
[go practical basis] how to bind and use URL parameters in gin
企业级SaaS CRM实现
Beats (filebeat, metricbeat), kibana, logstack tutorial of elastic stack
Double non undergraduate students enter the factory, while I am still quietly climbing trees at the bottom (Part 1)
JVM指令助记符
C语言之判断直角三角形
Matplotlib剑客行——没有工具用代码也能画图的造型师
Knife4j 2.X版本文件上传无选择文件控件问题解决
Solutions to Chinese garbled code in CMD window
定时线程池实现请求合并
双非本科生进大厂,而我还在底层默默地爬树(上)
概率还不会的快看过来《统计学习方法》——第四章、朴素贝叶斯法
AMQ 4043 solution for errors when using IBM MQ remote connection
[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 set the route in gin