20155210 实验4 恶意代码分析

实验4 恶意代码分析

系统运行监控

1.Schtasks

  • 先建立一个netstat20155210.txt文件,在文件中输入
date /t >> c:
etstat20155210.txt
time /t >> c:
etstat20155210.txt
netstat -bn >> c:
etstat20155210.txt
  • 然后将此文件名改为netstat20155210.bat

  • 再建立一个netstat20155210.txt,用来将记录的联网结果格式化输出到其中

  • 将这两个文件剪切到c盘目录下

方法一

  • 然后,以管理员身份打开命令行,输入schtasks /create /TN netstat /sc MINUTE /MO 1 /TR "c: etstat20155210.bat"

如图:

  • TN:Task Name,本例中是netstat

  • SC: SChedule type,本例中是MINUTE,以分钟来计时

  • MO: MOdifier

  • TR: Task Run,要运行的指令是 netstat -bn,b表示显示可执行文件名,n表示以数字来显示IP和端口

  • 打开netstat20155210.txt,得到如图:

  • 查找5210(1).exe通过5210端口在调用svchost.exe.

方法二

  • 打开控制面板,搜索计划任务

  • 选择创建任务,名称设为20155210,并选择使用最高权限运行

  • 创建触发器

  • 创建任务

Sysinternals工具集

2.1Sysmon

<Sysmon schemaversion="4.00">      //4.00为你的版本号,如不知道版本号,可先运行下面的指令,根据所提示的错误进行更改
  <!-- Capture all hashes -->
  <HashAlgorithms>*</HashAlgorithms>
  <EventFiltering>
<!-- Log all drivers except if the signature -->
<!-- contains Microsoft or Windows -->
<DriverLoad onmatch="exclude">
  <Signature condition="contains">microsoft</Signature>
  <Signature condition="contains">windows</Signature>
</DriverLoad>

<NetworkConnect onmatch="exclude">
  <Image condition="end with">chrome.exe</Image>
  <Image condition="end with">iexplorer.exe</Image>
  <SourcePort condition="is">137</SourcePort>
</NetworkConnect>

<CreateRemoteThread onmatch="include">
  <TargetImage condition="end with">explorer.exe</TargetImage>
  <TargetImage condition="end with">svchost.exe</TargetImage>
  <TargetImage condition="end with">winlogon.exe</TargetImage>
  <SourceImage condition="end with">powershell.exe</SourceImage>
</CreateRemoteThread>
  </EventFiltering>
</Sysmon>
  • 然后,以管理员身份运行命令行,输入Sysmon.exe -i 20155210.txt

如图:

  • 配置文件可以随时修改,修改完需要用如下指令更新一下Sysmon.exe -c 20155210.txt

  • 然后我们打开控制面板,搜索事件查看,打开事件查看器,sysmon的日志就在,应用程序和服务日志/Microsoft/Windows/Sysmon/Operational下

如图:

  • 我们对日志进行查看

如图:

  • 上图为sysmon创建进程

  • 上图为QQBrowers.exe,更新日志

  • 上图为360利用tcp对本机进行连接。

  • 上图为sysmon启动

  • 上图为360speedld.exe进程结束

如图:

  • 接下来,我们主要对80,443端口进行监视

  • 利用下面的代码对20155210.txt进行更改,然后使用sysmon.exe -c 20155210.txt,进行更新。

<Sysmon schemaversion="4.00">
  <!-- Capture all hashes -->
  <HashAlgorithms>*</HashAlgorithms>
  <EventFiltering>
<!-- Log all drivers except if the signature -->
<!-- contains Microsoft or Windows -->
<DriverLoad onmatch="exclude">
  <Signature condition="contains">microsoft</Signature>
  <Signature condition="contains">windows</Signature>
</DriverLoad>

<NetworkConnect onmatch="exclude">
  <Image condition="end with">SogouExplorer.exe</Image>
</NetworkConnect>

<NetworkConnect onmatch="include">     
  <DestinationPort condition="is">80</DestinationPort>      
  <DestinationPort condition="is">443</DestinationPort>
  <DestinationPort condition="is">5210</DestinationPort>    
</NetworkConnect>

<CreateRemoteThread onmatch="include">
  <TargetImage condition="end with">explorer.exe</TargetImage>
  <TargetImage condition="end with">svchost.exe</TargetImage>
  <TargetImage condition="end with">winlogon.exe</TargetImage>
  <SourceImage condition="end with">powershell.exe</SourceImage>
</CreateRemoteThread>
  </EventFiltering>
</Sysmon>

如图:

  • 然后我们来查看事件查看器,如图:

  • 5210(1).exe,利用tcp,进行network连接,目的端口为5210,资源端口为18477

2.2TCPview

  • 首先,先对其进行下载,下载地址与sysmon下载地址相同

  • 直接打开,可看到如图:

  • 查阅资料一般localport 为cifs都是后门,cifs是一个新提出的协议,它使程序可以访问远程Internet计算机上的文件并要求此计算机提供服务。很明显如果有程序的LocalPort显示为cifs的时候就要注意了

恶意软件分析

Systracer

  • 首先我们进行下载,安装

  • 然后进行快照,我快照了3次,分别为

1.windows什么都不运行

2.尝试回连

3.kali输入dir

  • 上图可看出后门再更改注册表

  • 上图为2与3对比,发现main.exe在运行,并且新增了svchost服务。

问题

(1)如果在工作中怀疑一台主机上有恶意代码,但只是猜想,所有想监控下系统一天天的到底在干些什么。请设计下你想监控的操作有哪些,用什么方法来监控。

  • 用TCPview,监听观察是否有localport为cifs的

  • 用Schtasks,查看是否有可疑netstat连接

  • 用sysmon,查看id为3的,是否有可以进程进行连接

(2)如果已经确定是某个程序或进程有问题,你有什么工具可以进一步得到它的哪些信息。

  • systracer 可以得到,该进程运行后注册表,文件,进程的变化
原文地址:https://www.cnblogs.com/panyinghao/p/8783960.html