Clear all dangerous extended stored procedures for SQL Server 2000
-- Rename the xplog70.dll file after clearing it.
-- I don't know which dynamic library is used to query sp_helpextendedproc xp_cmdshell.
---------------------------------------------------------------------------
-- Problems that may occur after the extended stored procedure is deleted
-- Xp_mongoshell [after this extension is deleted, the database cannot be remotely connected]
-- Xp_dirtree [this extension cannot be created or attached after it is deleted] it is used to restore the backup. Do not delete it unless necessary.
-- Xp_regread [restore database assistance after this extension is deleted] used to restore backup. Do not delete this extension unless necessary.
-- Xp_fixeddrives [the database cannot be restored after this extension is deleted] it is used to restore the backup. Do not delete it unless necessary.
-- Sp_OACreate [some functions in enterprise manager cannot be used after deletion]
-- Sp_OADestroy [some functions in enterprise manager cannot be used after deletion]
-- Sp_OAGetErrorInfo [some functions in enterprise manager cannot be used after deletion]
-- Sp_OAGetProperty [some functions in enterprise manager cannot be used after deletion]
-- Sp_OAMethod [some functions in the enterprise manager cannot be used after deletion]
-- Sp_OASetProperty [some functions in enterprise manager cannot be used after deletion]
-- Sp_OAStop [some functions in the enterprise manager cannot be used after deletion]
---------------------------------------------------------------------------
-- Description of each extended stored procedure
-- Xp_cmdshell -- it can execute any commands of the operating system.
-- Xp_dirtree -- used to list files and folders in the corresponding directory
-- Xp_enumgroups -- list the group used by the current system and its description
-- Xp_fixeddrives -- list all drive names and free space on each drive
-- Xp_loginconfig -- some server security configuration information
-- Xp_enumerrorlogs -- enumerate domain name information
-- Xp_getfiledetails --
-- Sp_OACreate -- OLE automatic stored procedure, which is no less dangerous than xp_mongoshell. After deletion, some functions in the enterprise manager cannot be used.
-- Sp_OADestroy -- OLE automatic stored procedure, which is no less dangerous than xp_mongoshell. After deletion, some functions in the enterprise manager cannot be used.
-- Sp_OAGetErrorInfo -- OLE automatic stored procedure, which is no less dangerous than xp_mongoshell. After deletion, some functions in the enterprise manager cannot be used.
-- Sp_OAGetProperty -- OLE automatic stored procedure, which is no less dangerous than xp_mongoshell. After deletion, some functions in the enterprise manager cannot be used.
-- Sp_OAMethod -- OLE automatic stored procedure, which is no less dangerous than xp_mongoshell. After deletion, some functions in the enterprise manager cannot be used.
-- Sp_OASetProperty -- OLE automatic stored procedure, which is no less dangerous than xp_mongoshell. After deletion, some functions in the enterprise manager cannot be used.
-- Sp_OAStop -- OLE automatic storage process, which is no less dangerous than xp_mongoshell. After deletion, some functions in the enterprise manager cannot be used.
-- Xp_regaddmultistring --
-- Xp_regdeletekey -- the key specified by the registry can be deleted.
-- Xp_regdeletevalue -- deletes the value specified in the key specified in the registry.
-- Xp_regenumkeys -- enumeration
-- Xp_regenumvalues --
-- Xp_regread -- can read the specified value in the key specified by the registry.
-- Xp_regremovemultistring --
-- Xp_regwrite -- the value specified in the key specified in the registry can be written.
-- Sp_makewebtask --
---------------------------------------------------------------------------
-- Delete
Use master
Exec sp_dropextendedproc 'XP _ export shell'
-- Exec sp_dropextendedproc 'XP _ dirtree'
Exec sp_dropextendedproc 'XP _ enumgroups'
-- Exec sp_dropextendedproc 'XP _ fixeddrives'
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 _ oagetproperties'
Exec sp_dropextendedproc 'sp _ oamethod'
Exec sp_dropextendedproc 'sp _ oasetproperties'
Exec sp_dropextendedproc 'sp _ oastop'
Exec sp_dropextendedproc 'XP _ regaddmultistring'
Exec sp_dropextendedproc 'XP _ regdeletekey'
Exec sp_dropextendedproc 'XP _ regdeletevalue'
Exec sp_dropextendedproc 'XP _ regenumkeys'
Exec sp_dropextendedproc 'XP _ regenumvalues'
-- Exec sp_dropextendedproc 'XP _ regread'
Exec sp_dropextendedproc 'XP _ regremovemultistring'
Exec sp_dropextendedproc 'XP _ regwrite'
Drop procedure sp_makewebtask
Go
---------------------------------------------------------------------------
-- Restore
Use master
Exec sp_addextendedproc xp_cmdshell, 'loglog70. dll'
Exec sp_addextendedproc xp_dirtree, 'xpstar. dll'
Exec sp_addextendedproc xp_enumgroups, 'XP log70. 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'
Go