1---2name: hunting-for-persistence-mechanisms-in-windows3description: Systematically hunt for adversary persistence mechanisms across Windows endpoints including registry, services, startup folders, and WMI subscriptions.4license: Apache-2.05---6
7# Hunting for Persistence Mechanisms in Windows
8
9## When to Use
10
11- During periodic proactive threat hunts for dormant backdoors
12- After an incident to identify all persistence mechanisms an attacker planted
13- When investigating unusual services, scheduled tasks, or startup entries
14- When threat intel reports describe new persistence techniques in the wild
15- During security posture assessments to identify unauthorized persistent software
16
17## Prerequisites
18
19- Sysmon deployed with Event IDs 12/13/14 (Registry), 19/20/21 (WMI), 1 (Process Creation)
20- Windows Security Event forwarding for 4697 (Service Install), 4698 (Scheduled Task)
21- EDR with registry and file monitoring capabilities
22- PowerShell script block logging enabled (Event ID 4104)
23- Autoruns or equivalent baseline of legitimate persistent entries
24
25## Workflow
26
271. **Enumerate Known Persistence Locations**: Build a comprehensive list of Windows persistence points (Run keys, services, scheduled tasks, WMI, startup folder, DLL search order, COM hijacks, AppInit DLLs, Image File Execution Options).
282. **Collect Endpoint Data**: Use EDR, Sysmon, or Velociraptor to collect current persistence artifacts from endpoints across the environment.
293. **Baseline Legitimate Persistence**: Compare collected data against known-good baselines (Autoruns snapshots, GPO-deployed entries, SCCM configurations).
304. **Identify Anomalies**: Flag new, unsigned, or unknown entries in persistence locations that deviate from the baseline.
315. **Investigate Suspicious Entries**: For each anomaly, examine the binary it points to, its digital signature, file hash, and creation timestamp.
326. **Correlate with Process Activity**: Link persistence entries to process execution, network activity, and user login events.
337. **Document and Remediate**: Record findings, remove malicious persistence, and update detection rules.
34
35## Key Concepts
36
37| Concept | Description |
38|---------|-------------|
39| T1547.001 | Registry Run Keys / Startup Folder |
40| T1543.003 | Windows Service (Create or Modify) |
41| T1053.005 | Scheduled Task |
42| T1546.003 | WMI Event Subscription |
43| T1546.015 | Component Object Model (COM) Hijacking |
44| T1546.012 | Image File Execution Options Injection |
45| T1546.010 | AppInit DLLs |
46| T1547.004 | Winlogon Helper DLL |
47| T1547.005 | Security Support Provider |
48| T1574.001 | DLL Search Order Hijacking |
49| TA0003 | Persistence Tactic |
50| Autoruns | Sysinternals tool showing persistent entries |
51
52## Tools & Systems
53
54| Tool | Purpose |
55|------|---------|
56| Sysinternals Autoruns | Comprehensive persistence enumeration |
57| Velociraptor | Endpoint-wide persistence artifact collection |
58| CrowdStrike Falcon | Real-time persistence monitoring |
59| Sysmon | Registry and WMI event monitoring |
60| OSQuery | SQL-based persistence queries |
61| RECmd | Registry Explorer for forensic analysis |
62| Splunk | SIEM correlation of persistence events |
63
64## Common Scenarios
65
661. **Registry Run Key Backdoor**: Malware adds `HKCU\Software\Microsoft\Windows\CurrentVersion\Run` entry pointing to payload in `%APPDATA%`.
672. **WMI Event Subscription**: Adversary creates WMI consumer/filter pair that executes PowerShell on system boot.
683. **Malicious Service**: Attacker creates Windows service with `sc create` pointing to a backdoor binary.
694. **COM Object Hijack**: Legitimate COM CLSID InprocServer32 path replaced with malicious DLL.
705. **IFEO Debugger Injection**: Image File Execution Options key set with debugger pointing to implant for common utilities.
71
72## Output Format
73
74```
75Hunt ID: TH-PERSIST-[DATE]-[SEQ]
76Persistence Type: [Registry/Service/Task/WMI/COM/Other]
77MITRE Technique: T1547.xxx / T1543.xxx / T1053.xxx
78Location: [Full registry key / service name / task path]
79Value: [Binary path / command line]
80Host(s): [Affected endpoints]
81Signed: [Yes/No]
82Hash: [SHA256]
83Creation Time: [Timestamp]
84Risk Level: [Critical/High/Medium/Low]
85Verdict: [Malicious/Suspicious/Benign]
86```