Tech_Info/Database2006. 6. 26. 13:45
보안에 문제가 될 수 있는 xp_cmdshell 삭제하기

원본링크 : Implications of removing the xp_cmdshell stored procedure from SQL Server 2000
- http://support.microsoft.com/kb/891984/en-us

How to drop the xp_cmdshell stored procedure
- system administrator user right 필요
- to-drop :
exec sp_dropextendedproc 'xp_cmdshell'
- re-add :
exec sp_addextendedproc 'xp_cmdshell', 'xplog70.dll'

영향받는 stored procedure List

sp_ActiveDirectory_SCP sp_adddistpublisher sp_adddistributiondb sp_attachsubscription sp_changedistpublisher sp_copysubscription sp_MScopysnapshot sp_MScopyscriptfile sp_MSget_file_existence sp_MSremove_userscript sp_replicationoption sp_vupgrade_replication
sp_MSreplremoveuncdir sp_MSdeletefoldercontents sp_resolve_logins Sp_set_local_time sp_msx_defect sp_msx_enlist Xp_sscanf Xp_sprintf Xp_msver Xp_msver Xp_enumgroups Xp_logevent Xp_loginconfig

삭제하게 되면서 발생할 수 있는 메세지

ODBC: Msg 0, Level 16, State 1
Cannot load the DLL xplog70.dll, or one of the DLLs it references. Reason: 126(The specified module could not be found.).

Trying to configure Distributor for "server"
Fails with Error 2812: Could not find stored procedure 'master..xp_cmdshell'

Status: 0, code: 1007, text: 'Cannot load the DLL xplog70.dll, or one of the DLLs it references. Reason: 126(The specified module could not be found.).'.
Cannot load the DLL xplog70.dll, or one of the DLLs it references. Reason: 126(The specified module could not be found.).
Repl Agent Status: 6

An error occurred trying to execute a SQL Statement.

"Cannot enlist server 'ServerName' . Please upgrade server 'ServerName' to SQL Server 2000 sp3 or later.

“Cannot load the DLL xplog70.dll or one of the DLLs it references. Reason: 126(The specified module could not be found)
ServerName xp_msver


xplog70.dll을 삭제하고서 SQL Server Restart하면 더이상 sp_addextendedproc를 사용해서 등록할 수 없다.
쿼리분석기에서 다시 sp_addextendedproc 'xp_cmdshell', 'xplog70.dll'을 실행하면 정상적으로 실행되지만,
xp_cmdshell 'dir' 와 같이 실행하면,
ODBC: 메시지 0, 수준 16, 상태 1
xplog70.dll DLL 또는 이 DLL이 참조하는 DLL 중 하나를 로드할 수 없습니다. 이유: 126(지정된 모듈을 찾을 수 없습니다.). 라는 메세지를 뿌리면서 실패하게 된다.


'Tech_Info > Database' 카테고리의 다른 글

TableSpace 사용량 확인하는 script  (0) 2006.11.08
SQL Server Errorlog archive 개수 늘리기  (0) 2006.06.26
Posted by 알 수 없는 사용자