Persistence via WMI Event Subscription

An adversary can use Windows Management Instrumentation (WMI) to install event filters, providers, consumers, and bindings that execute code when a defined event occurs. Adversaries may use the capabilities of WMI to subscribe to an event and execute arbitrary code when that event occurs, providing persistence on a system.

Elastic rule (View on GitHub)

 1[metadata]
 2creation_date = "2020/12/04"
 3integration = ["endpoint", "windows", "system"]
 4maturity = "production"
 5updated_date = "2024/05/21"
 6
 7[rule]
 8author = ["Elastic"]
 9description = """
10An adversary can use Windows Management Instrumentation (WMI) to install event filters, providers, consumers, and
11bindings that execute code when a defined event occurs. Adversaries may use the capabilities of WMI to subscribe to an
12event and execute arbitrary code when that event occurs, providing persistence on a system.
13"""
14from = "now-9m"
15index = [
16    "logs-endpoint.events.process-*",
17    "winlogbeat-*",
18    "logs-windows.*",
19    "endgame-*",
20    "logs-system.security*",
21]
22language = "eql"
23license = "Elastic License v2"
24name = "Persistence via WMI Event Subscription"
25references = ["https://www.elastic.co/security-labs/hunting-for-persistence-using-elastic-security-part-1"]
26risk_score = 21
27rule_id = "9b6813a1-daf1-457e-b0e6-0bb4e55b8a4c"
28setup = """## Setup
29
30If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
31events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
32Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
33`event.ingested` to @timestamp.
34For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
35"""
36severity = "low"
37tags = [
38    "Domain: Endpoint",
39    "OS: Windows",
40    "Use Case: Threat Detection",
41    "Tactic: Persistence",
42    "Tactic: Execution",
43    "Data Source: Elastic Endgame",
44    "Data Source: Elastic Defend",
45]
46timestamp_override = "event.ingested"
47type = "eql"
48
49query = '''
50process where host.os.type == "windows" and event.type == "start" and
51  (process.name : "wmic.exe" or ?process.pe.original_file_name == "wmic.exe") and
52  process.args : "create" and
53  process.args : ("ActiveScriptEventConsumer", "CommandLineEventConsumer")
54'''
55
56
57[[rule.threat]]
58framework = "MITRE ATT&CK"
59[[rule.threat.technique]]
60id = "T1546"
61name = "Event Triggered Execution"
62reference = "https://attack.mitre.org/techniques/T1546/"
63[[rule.threat.technique.subtechnique]]
64id = "T1546.003"
65name = "Windows Management Instrumentation Event Subscription"
66reference = "https://attack.mitre.org/techniques/T1546/003/"
67
68
69
70[rule.threat.tactic]
71id = "TA0003"
72name = "Persistence"
73reference = "https://attack.mitre.org/tactics/TA0003/"
74[[rule.threat]]
75framework = "MITRE ATT&CK"
76[[rule.threat.technique]]
77id = "T1047"
78name = "Windows Management Instrumentation"
79reference = "https://attack.mitre.org/techniques/T1047/"
80
81
82[rule.threat.tactic]
83id = "TA0002"
84name = "Execution"
85reference = "https://attack.mitre.org/tactics/TA0002/"

References

Related rules

to-top