講解SQL Server危險擴充套件儲存刪除和恢復

iSQlServer發表於2009-02-05
將有安全問題的SQL過程刪除.比較全面.一切為了安全!

刪除了呼叫shell,登錄檔,COM元件的破壞許可權

MS SQL SERVER2000

使用系統帳戶登陸查詢分析器

執行以下指令碼:

use master

exec sp_dropextendedproc 'xp_cmdshell'

exec sp_dropextendedproc 'xp_enumgroups'

exec sp_dropextendedproc 'xp_loginconfig'

exec sp_dropextendedproc 'xp_enumerrorlogs'

exec sp_dropextendedproc 'xp_getfiledetails'

exec sp_dropextendedproc 'Sp_OACreate'

exec sp_dropextendedproc 'Sp_OADestroy'

exec sp_dropextendedproc 'Sp_OAGetErrorInfo'

exec sp_dropextendedproc 'Sp_OAGetProperty'

exec sp_dropextendedproc 'Sp_OAMethod'

exec sp_dropextendedproc 'Sp_OASetProperty'

exec sp_dropextendedproc 'Sp_OAStop'

exec sp_dropextendedproc 'xp_regaddmultistring'

exec sp_dropextendedproc 'xp_regdeletekey'

exec sp_dropextendedproc 'xp_regdeletevalue'

exec sp_dropextendedproc 'xp_regenumvalues'

exec sp_dropextendedproc 'xp_regremovemultistring'

exec sp_dropextendedproc 'xp_regwrite'

drop procedure sp_makewebtask

go

刪除所有危險的擴充套件:

exec sp_dropextendedproc 'xp_cmdshell' [刪除此項擴充套件後,將無法遠端連線資料庫]

以下3個儲存過程會在SQL SERVER恢復備份時被使用,非必要請勿刪除

#exec sp_dropextendedproc 'xp_dirtree' [刪除此項擴充套件後,將無法新建或附加資料庫]

#exec sp_dropextendedproc 'Xp_regread' [刪除此項擴充套件後, 還原資料庫輔助]

#exec sp_dropextendedproc 'xp_fixeddrives' [刪除此項擴充套件後,將無法還原資料庫]

恢復指令碼

use master

EXEC sp_addextendedproc xp_cmdshell ,@dllname ='xplog70.dll'

EXEC sp_addextendedproc xp_enumgroups ,@dllname ='xplog70.dll'

EXEC sp_addextendedproc xp_loginconfig ,@dllname ='xplog70.dll'

EXEC sp_addextendedproc xp_enumerrorlogs ,@dllname ='xpstar.dll'

EXEC sp_addextendedproc xp_getfiledetails ,@dllname ='xpstar.dll'

EXEC sp_addextendedproc Sp_OACreate ,@dllname ='odsole70.dll'

EXEC sp_addextendedproc Sp_OADestroy ,@dllname ='odsole70.dll'

EXEC sp_addextendedproc Sp_OAGetErrorInfo ,@dllname ='odsole70.dll'

EXEC sp_addextendedproc Sp_OAGetProperty ,@dllname ='odsole70.dll'

EXEC sp_addextendedproc Sp_OAMethod ,@dllname ='odsole70.dll'

EXEC sp_addextendedproc Sp_OASetProperty ,@dllname ='odsole70.dll'

EXEC sp_addextendedproc Sp_OAStop ,@dllname ='odsole70.dll'

EXEC sp_addextendedproc xp_regaddmultistring ,@dllname ='xpstar.dll'

EXEC sp_addextendedproc xp_regdeletekey ,@dllname ='xpstar.dll'

EXEC sp_addextendedproc xp_regdeletevalue ,@dllname ='xpstar.dll'

EXEC sp_addextendedproc xp_regenumvalues ,@dllname ='xpstar.dll'

EXEC sp_addextendedproc xp_regremovemultistring ,@dllname ='xpstar.dll'

EXEC sp_addextendedproc xp_regwrite ,@dllname ='xpstar.dll'

EXEC sp_addextendedproc xp_dirtree ,@dllname ='xpstar.dll'

EXEC sp_addextendedproc xp_regread ,@dllname ='xpstar.dll'

EXEC sp_addextendedproc xp_fixeddrives ,@dllname ='xpstar.dll'

go

全部複製到"SQL查詢分析器"

點選選單上的--"查詢"--"執行",就會將有安全問題的SQL過程刪除。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/16436858/viewspace-545387/,如需轉載,請註明出處,否則將追究法律責任。

相關文章