恢复被注入挂马的SQL数据库

--///////////////////////////////////////////
--查询分析器里执行
declare @mf varchar(8000),
@m varchar(8000)


declare cur_AA cursor for select o.name,c.name from sysobjects o join syscolumns c on o.id=c.id where o.xtype='U' and o.status>0 and c.xtype in (99,35,167,175,231,239) order by o.name
open cur_AA
Fetch Next From Cur_AA
into @mf,@m
while @@fetch_Status=0
begin

exec('update ' + @mf + ' set ' + @m + '=replace(convert(varchar(8000),' + @m + '),''<script src=http://3b3.org/c.js></script>'','''')')

Fetch Next From Cur_AA
into @mf,@m

end
close cur_AA
deallocate cur_AA

---///完

<script src=http://3b3.org/c.js></script> 替换为再数据库里被实际注入的脚本内容。

字段类型说明:

xtype=34 'image'
xtype= 35 'text'
xtype=36 'uniqueidentifier'
xtype=48 'tinyint'
xtype=52 'smallint'
xtype=56 'int'
xtype=58 'smalldatetime'
xtype=59 'real'
xtype=60 'money'
xtype=61 'datetime'
xtype=62 'float'
xtype=98 'sql_variant'
xtype=99 'ntext'
xtype=104 'bit'
xtype=106 'decimal'
xtype=108 'numeric'
xtype=122 'smallmoney'
xtype=127 'bigint'
xtype=165 'varbinary'
xtype=167 'varchar'
xtype=173 'binary'
xtype=175 'char'
xtype=189 'timestamp'
xtype=231 'nvarchar'
xtype=239 'nchar'
xtype=241 'xml'
xtype=231 'sysname'


-----//////////////////以上解决办法来自于csdn kimsoft's blog 与 小胖 修正。


[本日志由 jit 于 2009-03-09 01:32 PM 编辑]
上一篇: 利用正则快速查找与清理挂马
下一篇: FreeBSD 学习资料
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: sql注入 挂马
相关日志:
评论: 0 | 引用: 0 | 查看次数: -
发表评论
昵 称:
密 码: 游客发言不需要密码.
邮 箱: 邮件地址支持Gravatar头像,邮箱地址不会公开.
网 址: 输入网址便于回访.
内 容:
验证码:
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 1000 字 | UBB代码 关闭 | [img]标签 关闭