web9
2025年6月18日小于 1 分钟

分析一下
1. 上bp扫描

robots.txt不让访问/index.phps那就直接看看
<?php
$flag="";
$password=$_POST['password'];
if(strlen($password)>10){
die("password error");
}
$sql="select * from user where username ='admin' and password ='".md5($password,true)."'";
$result=mysqli_query($con,$sql);
if(mysqli_num_rows($result)>0){
while($row=mysqli_fetch_assoc($result)){
echo "登陆成功<br>";
echo $flag;
}
}
?>- 输入密码长度大于10 就会返回
password error
关键漏洞:
md5($password, true)- 第二个参数为
true意味着返回原始二进制格式(16字节) - 二进制数据可能包含特殊字符,导致SQL注入
- 第二个参数为
限制条件:
- 密码长度不能超过10个字符
- 需要找到一个密码,其MD5二进制结果能够闭合SQL语句
解题思路
需要找到一个字符串,使得其MD5二进制输出包含能够构造SQL注入的字符序列。
经过测试,以下字符串可以利用:
解法1:使用 ffifdyop
password: ffifdyop原理:
ffifdyop的MD5值(十六进制):276f722736c95d99e921722cf9ed621c- 转换为二进制后包含:
'or'6... - 构成的SQL语句:
select * from user where username ='admin' and password =''or'6...' - 这样就绕过了密码验证
