Detecting Wmi Persistence
Overview
Cybersecurity skill for detecting wmi persistence. Follows industry best practices and security standards.
When to Use
Trigger phrases:
"detecting wmi persistence"
"When hunting for WMI event subscription persistence (MITRE ATT&CK T1546"
"After detecting suspicious WMI activity in endpoint telemetry"
"During incident response to identify attacker persistence mechanisms"
When hunting for WMI event subscription persistence (MITRE ATT&CK T1546.003)
After detecting suspicious WMI activity in endpoint telemetry
During incident response to identify attacker persistence mechanisms
When Sysmon alerts trigger on Event IDs 19, 20, or 21
During purple team exercises testing WMI-based persistence
When NOT to Use
- When you lack proper authorization for testing
- For production systems without change management
- When the task requires legal or compliance expertise beyond technical scope
Prerequisites
- Sysmon v6.1+ deployed with WMI event logging enabled (Event IDs 19, 20, 21)
- Windows Security Event Log forwarding configured
- SIEM with Sysmon data ingested (Splunk, Elastic, Sentinel)
- PowerShell access for WMI enumeration on endpoints
- Sysinternals Autoruns for manual WMI subscription review
Workflow
# Example: IOC detection
import re
IOC_PATTERNS = {
"ip": r"\b(?:\d{1,3}\.){3}\d{1,3}\b",
"domain": r"\b[a-z0-9-]+\.[a-z]{2,}\b",
"hash_md5": r"\b[a-f0-9]{32}\b",
"hash_sha256": r"\b[a-f0-9]{64}\b",
}
def extract_iocs(text: str) -> dict:
return {k: re.findall(v, text) for k, v in IOC_PATTERNS.items()}
- Define Detection Scope — Identify the specific wmi persistence techniques or indicators to hunt. Map to MITRE ATT&CK tactics/techniques where applicable.
- Collect Baseline Data — Gather historical logs and establish normal behavior patterns for wmi persistence.
- Build Detection Queries — Write detection rules, Sigma rules, or SIEM queries targeting wmi persistence indicators.
- Execute Hunts — Run queries against the collected data, starting with broad filters and narrowing down.
- Triage Results — Investigate alerts, filter false positives, and validate findings against known-good behavior.
- Document Findings — Record confirmed detections, IOCs, and affected systems. Update detection rules based on findings.
Tools
- SIEM Platform — Central log aggregation and query execution
- Sigma Rules — Vendor-agnostic detection rule format
- MITRE ATT&CK Navigator — Technique mapping and coverage analysis
Process
- Reconnaissance — Gather target information, identify attack surface, enumerate services
- Analysis/Exploitation — Execute the technique, analyze results, document findings
- Reporting — Document IOCs, write findings, provide remediation recommendations
Verification
Anti-Rationalization Table
| Rationalization |
Reality |
| "We are too small to be targeted" |
Automated attacks target everyone. Size does not matter. |
| "Security slows us down" |
A breach slows you down 100x more. Build security in from the start. |
| "We will fix it after launch" |
Vulnerabilities in production are exploited within hours. Fix before deploy. |
1---2name: detecting-wmi-persistence3description: Use when detect WMI event subscription persistence by analyzing Sysmon4 Event IDs 19, 20, and 21 for malicious EventFilter, EventConsumer, and FilterToConsumerBinding5 creation. Use when detecting wmi event subscription persistence by analyzing sysmon6 event ids.7domain: cybersecurity8tags:9- threat-hunting10- wmi11- persistence12- sysmon13- t1546.00314- mitre-attack15- windows16- dfir17subdomain: threat-hunting18version: '1.0'19author: oyi7720license: Apache-2.021d3fend_techniques:22- Application Protocol Command Analysis23- Network Isolation24- Network Traffic Analysis25- Client-server Payload Profiling26- Platform Monitoring27nist_csf:28- DE.CM-0129- DE.AE-0230- DE.AE-0731- ID.RA-0532category: cybersecurity33metadata:34 source: https://skillmd.com/skills/oyi77/detecting-wmi-persistence35---3637# Detecting Wmi Persistence3839## Overview4041Cybersecurity skill for detecting wmi persistence. Follows industry best practices and security standards.4243## When to Use4445**Trigger phrases:**46- "detecting wmi persistence"47- "When hunting for WMI event subscription persistence (MITRE ATT&CK T1546"48- "After detecting suspicious WMI activity in endpoint telemetry"49- "During incident response to identify attacker persistence mechanisms"505152- When hunting for WMI event subscription persistence (MITRE ATT&CK T1546.003)53- After detecting suspicious WMI activity in endpoint telemetry54- During incident response to identify attacker persistence mechanisms55- When Sysmon alerts trigger on Event IDs 19, 20, or 2156- During purple team exercises testing WMI-based persistence575859## When NOT to Use6061- When you lack proper authorization for testing62- For production systems without change management63- When the task requires legal or compliance expertise beyond technical scope646566## Prerequisites6768- Sysmon v6.1+ deployed with WMI event logging enabled (Event IDs 19, 20, 21)69- Windows Security Event Log forwarding configured70- SIEM with Sysmon data ingested (Splunk, Elastic, Sentinel)71- PowerShell access for WMI enumeration on endpoints72- Sysinternals Autoruns for manual WMI subscription review7374## Workflow7576```python77# Example: IOC detection78import re7980IOC_PATTERNS = {81 "ip": r"\b(?:\d{1,3}\.){3}\d{1,3}\b",82 "domain": r"\b[a-z0-9-]+\.[a-z]{2,}\b",83 "hash_md5": r"\b[a-f0-9]{32}\b",84 "hash_sha256": r"\b[a-f0-9]{64}\b",85}8687def extract_iocs(text: str) -> dict:88 return {k: re.findall(v, text) for k, v in IOC_PATTERNS.items()}89```90911. **Define Detection Scope** — Identify the specific wmi persistence techniques or indicators to hunt. Map to MITRE ATT&CK tactics/techniques where applicable.922. **Collect Baseline Data** — Gather historical logs and establish normal behavior patterns for wmi persistence.933. **Build Detection Queries** — Write detection rules, Sigma rules, or SIEM queries targeting wmi persistence indicators.944. **Execute Hunts** — Run queries against the collected data, starting with broad filters and narrowing down.955. **Triage Results** — Investigate alerts, filter false positives, and validate findings against known-good behavior.966. **Document Findings** — Record confirmed detections, IOCs, and affected systems. Update detection rules based on findings.9798## Tools99100- **SIEM Platform** — Central log aggregation and query execution101- **Sigma Rules** — Vendor-agnostic detection rule format102- **MITRE ATT&CK Navigator** — Technique mapping and coverage analysis103104105## Process1061071. **Reconnaissance** — Gather target information, identify attack surface, enumerate services1081. **Analysis/Exploitation** — Execute the technique, analyze results, document findings1091. **Reporting** — Document IOCs, write findings, provide remediation recommendations110111## Verification112113- [ ] All wmi persistence procedures executed completely and documented114- [ ] Findings validated against multiple data sources115- [ ] False positives identified and filtered116- [ ] Results documented with evidence and timestamps117- [ ] Recommendations provided with risk-based prioritization118119## Anti-Rationalization Table120121| Rationalization | Reality |122|---|---|123| "We are too small to be targeted" | Automated attacks target everyone. Size does not matter. |124| "Security slows us down" | A breach slows you down 100x more. Build security in from the start. |125| "We will fix it after launch" | Vulnerabilities in production are exploited within hours. Fix before deploy. |