【系统审计】sysmon的安装与使用

一、sysmon介绍

         系统监视器(Sysmon)是Windows系统服务和设备驱动程序,用来监视系统活动并将其记录在window事件日记中。

二、sysmon安装

         

# 下载地址
https://download.sysinternals.com/files/Sysmon.zip

# 安装
Sysmon.exe -i <configfile> # 指定配置文件安装

# 修改配置
Sysmon.exe -c <configfile> 

# 修改为默认配置
sysmon –c -- # 修改配置信息为默认配置

# 卸载
 Sysmon.exe -u 

三、配置文件解析

  1 过滤器

 ProcessCreate            进程创建
 FileCreateTime           文件创建时间更改
 NetworkConnect           检测到网络连接
 ProcessTerminate         进程终止
 DriverLoad               驱动程序已加载
 ImageLoad                镜像加载
 CreateRemoteThread       已检测到创建远程线程
 RawAccessRead            检测到原始访问读取
 ProcessAccess            已访问的进程
 FileCreate               文件创建
 RegistryEvent            添加或删除注册表对象
 RegistryEvent            注册表值设置
 RegistryEvent            注册表对象已重命名
 FileCreateStreamHash     已创建文件流
 PipeEvent                管道创建
 PipeEvent                管道已连接
 WmiEvent                 检测到WmiEventFilter活动 -- WmiEventFilter activity detected
 WmiEvent                 检测到WmiEventConsumer活动 -- WmiEventConsumer activity detected
 WmiEvent                 检测到WmiEventConsumerToFilter活动 -- WmiEventConsumerToFilter activity 
 DnsQuery                 DNS查询

  2 标签使用说明

 

使用onmacth标记配置文件中 过滤器规则 include exclude
include:
     仅包含include的规则配置 
exclude: 
     除去该规则配置, 其他全包含 
PS: 
     例如,此规则将丢弃进程创建中 IntegrityLevel 为中等的任何流程事件
      <ProcessCreate onmatch="exclude">
          <IntegrityLevel>Medium</IntegrityLevel>
     </ProcessCreate>

  3 过滤器标签的字段可以使用其他条件匹配该值

--------------------------------------
注: 不区分大小写
--------------------------------------
字段如下:
     is             默认值, 等于
     is not         不等于 
     contains       包含
     excludes       不包含
     begin with     以此字段开始
     end with       以此字段结束
     less than      小于
     more than      大于 
     image          匹配镜像路径(完整路径或仅镜像名称) 
     例如:lsass.exe将匹配c:\windows\system32\lsass.exe
     
-----------------------------------------

 4 配置文件举例

<Sysmon schemaversion="4.20">
  <!-- Capture all hashes -->
  <HashAlgorithms>*</HashAlgorithms>
  <EventFiltering>
    <!-- Log all drivers except if the signature -->
    <!-- contains Microsoft or Windows -->

    <ProcessCreate onmatch="exclude">     
      <Image condition="end with">chrome.exe</Image> 
    </ProcessCreate>

    <FileCreateTime onmatch="exclude" >
      <Image condition="end with">chrome.exe</Image>
    </FileCreateTime>
    
    <NetworkConnect onmatch="exclude">
      <Image condition="end with">chrome.exe</Image>
      <SourcePort condition="is">137</SourcePort>
      <SourceIp condition="is">127.0.0.1</SourceIp>
    </NetworkConnect>
    <NetworkConnect onmatch="include">     
      <DestinationPort condition="is">80</DestinationPort>      
      <DestinationPort condition="is">443</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>

 四、结果查看

        按键Win+X->事件查看器->应用程序和服务日志->Microsoft->Windows->Sysmon->Operational

 五、安装常见错误

       错误1:

 原因:配置文件与本地安装sysmon版本不一致导致,修改配置文件中sysmon版本为本地安装版本即可解决。

  错误2:

 

 原因:本地安装用户没有启动管理员权限,通过win+x 启动windows powershell 管理员安装即可解决。

 

参考文档

  sysmon官方文档:https://docs.microsoft.com/zh-cn/sysinternals/downloads/sysmon

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值