The interface is localized. Skill descriptions and documents are machine-translated by AI into your language; code, commands, paths and technical terms stay in the original, and the author's document governs.
Explore skills
Productivity · SKILL.md

detecting-wmi-persistence

detecting-wmi-persistence

通过分析 Sysmon 事件 ID 19、20 和 21 中的恶意 EventFilter、EventConsumer 和 FilterToConsumerBinding 创建,检测 WMI 事件订阅持久化。

Independent GitHub snapshot · Automated classification · Original documentation governs

Skill documentation

GitHub

name: detecting-wmi-persistence description: 通过分析 Sysmon 事件 ID 19、20 和 21 中的恶意 EventFilter、EventConsumer 和 FilterToConsumerBinding 创建,检测 WMI 事件订阅持久化。 domain: cybersecurity subdomain: threat-hunting tags: [threat-hunting, wmi, persistence, sysmon, t1546.003, mitre-attack, windows, dfir] version: "1.0" author: mahipal license: Apache-2.0

检测 WMI 持久化

适用场景

  • 狩猎 WMI 事件订阅持久化(MITRE ATT&CK T1546.003)时
  • 在终端遥测中检测到可疑 WMI 活动后
  • 事件响应期间识别攻击者的持久化机制时
  • Sysmon 告警触发事件 ID 19、20 或 21 时
  • 紫队演练测试基于 WMI 的持久化时

前置条件

  • 部署了启用 WMI 事件日志的 Sysmon v6.1+(事件 ID 19、20、21)
  • 已配置 Windows 安全事件日志转发
  • 已接入 Sysmon 数据的 SIEM(Splunk、Elastic、Sentinel)
  • 终端上的 PowerShell 访问权限(用于 WMI 枚举)
  • Sysinternals Autoruns(用于手动 WMI 订阅审查)

工作流程

  1. 收集遥测数据:解析 Sysmon 事件 ID 19(WmiEventFilter)、20(WmiEventConsumer)、21(WmiEventConsumerToFilter)。
  2. 识别可疑消费者:标记执行代码的 CommandLineEventConsumer 和 ActiveScriptEventConsumer 类型。
  3. 分析事件过滤器:检查 EventFilter 中的 WQL 查询,查找进程启动触发器或基于计时器的执行。
  4. 关联绑定:匹配将可疑过滤器连接到消费者的 FilterToConsumerBinding。
  5. 检查持久化位置:查询 WMI 命名空间 root\subscription 和 root\default 中的活跃订阅。
  6. 验证发现:与已知合法的 WMI 订阅(SCCM、AV 产品)交叉参考。
  7. 记录并修复:删除恶意订阅并更新检测规则。

核心概念

概念描述
Sysmon 事件 19检测到 WmiEventFilter 创建
Sysmon 事件 20检测到 WmiEventConsumer 创建
Sysmon 事件 21检测到 WmiEventConsumerToFilter 绑定
T1546.003事件触发执行:WMI 事件订阅
CommandLineEventConsumer过滤器触发时执行系统命令
ActiveScriptEventConsumer过滤器触发时运行 VBScript/JScript

工具与系统

工具用途
SysmonWMI 活动的 Windows 事件监控
WMI Explorer浏览 WMI 命名空间的 GUI 工具
Autoruns列出持久化机制的 Sysinternals 工具
PowerShell Get-WMIObject枚举 WMI 事件订阅
SplunkSysmon WMI 事件的 SIEM 分析
Velociraptor终端 WMI 工件收集

输出格式

Hunt ID: TH-WMI-[DATE]-[SEQ]
Technique: T1546.003
Host: [主机名]
Event Type: [EventFilter|EventConsumer|Binding]
Consumer Type: [CommandLine|ActiveScript]
WQL Query: [过滤器查询文本]
Command: [执行的命令或脚本]
Risk Level: [Critical/High/Medium/Low]
Recommended Action: [删除订阅,调查横向移动]
Saved skills