1---
2name: hunting-for-persistence-mechanisms-in-windows
3description: Systematically hunt for adversary persistence mechanisms across Windows
4 endpoints including registry, services, startup folders, and WMI subscriptions.
5domain: cybersecurity
6subdomain: threat-hunting
7tags:
8- threat-hunting
9- mitre-attack
10- persistence
11- windows
12- registry
13- siem
14- proactive-detection
15version: '1.0'
16author: mahipal
17license: Apache-2.0
18d3fend_techniques:
19- Executable Denylisting
20- Execution Isolation
21- File Metadata Consistency Validation
22- Content Format Conversion
23- File Content Analysis
24nist_csf:
25- DE.CM-01
26- DE.AE-02
27- DE.AE-07
28- ID.RA-05
29mitre_attack:
30- T1046
31- T1057
32- T1082
33- T1083
34- T1547
35source: https://github.com/mukul975/Anthropic-Cybersecurity-Skills
36source_commit: 04450304b12645cb2b974ab96d28c0664758a88d
37metadata:
38 source: https://skillmd.com/skills/yanacuti1121/hunting-for-persistence-mechanisms-in-windows
39---
40
41# Hunting for Persistence Mechanisms in Windows
42
43## When to Use
44
45- During periodic proactive threat hunts for dormant backdoors
46- After an incident to identify all persistence mechanisms an attacker planted
47- When investigating unusual services, scheduled tasks, or startup entries
48- When threat intel reports describe new persistence techniques in the wild
49- During security posture assessments to identify unauthorized persistent software
50
51## Prerequisites
52
53- Sysmon deployed with Event IDs 12/13/14 (Registry), 19/20/21 (WMI), 1 (Process Creation)
54- Windows Security Event forwarding for 4697 (Service Install), 4698 (Scheduled Task)
55- EDR with registry and file monitoring capabilities
56- PowerShell script block logging enabled (Event ID 4104)
57- Autoruns or equivalent baseline of legitimate persistent entries
58
59## Workflow
60
611. **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).
622. **Collect Endpoint Data**: Use EDR, Sysmon, or Velociraptor to collect current persistence artifacts from endpoints across the environment.
633. **Baseline Legitimate Persistence**: Compare collected data against known-good baselines (Autoruns snapshots, GPO-deployed entries, SCCM configurations).
644. **Identify Anomalies**: Flag new, unsigned, or unknown entries in persistence locations that deviate from the baseline.
655. **Investigate Suspicious Entries**: For each anomaly, examine the binary it points to, its digital signature, file hash, and creation timestamp.
666. **Correlate with Process Activity**: Link persistence entries to process execution, network activity, and user login events.
677. **Document and Remediate**: Record findings, remove malicious persistence, and update detection rules.
68
69## Key Concepts
70
71| Concept | Description |
72|---------|-------------|
73| T1547.001 | Registry Run Keys / Startup Folder |
74| T1543.003 | Windows Service (Create or Modify) |
75| T1053.005 | Scheduled Task |
76| T1546.003 | WMI Event Subscription |
77| T1546.015 | Component Object Model (COM) Hijacking |
78| T1546.012 | Image File Execution Options Injection |
79| T1546.010 | AppInit DLLs |
80| T1547.004 | Winlogon Helper DLL |
81| T1547.005 | Security Support Provider |
82| T1574.001 | DLL Search Order Hijacking |
83| TA0003 | Persistence Tactic |
84| Autoruns | Sysinternals tool showing persistent entries |
85
86## Tools & Systems
87
88| Tool | Purpose |
89|------|---------|
90| Sysinternals Autoruns | Comprehensive persistence enumeration |
91| Velociraptor | Endpoint-wide persistence artifact collection |
92| CrowdStrike Falcon | Real-time persistence monitoring |
93| Sysmon | Registry and WMI event monitoring |
94| OSQuery | SQL-based persistence queries |
95| RECmd | Registry Explorer for forensic analysis |
96| Splunk | SIEM correlation of persistence events |
97
98## Common Scenarios
99
1001. **Registry Run Key Backdoor**: Malware adds `HKCU\Software\Microsoft\Windows\CurrentVersion\Run` entry pointing to payload in `%APPDATA%`.
1012. **WMI Event Subscription**: Adversary creates WMI consumer/filter pair that executes PowerShell on system boot.
1023. **Malicious Service**: Attacker creates Windows service with `sc create` pointing to a backdoor binary.
1034. **COM Object Hijack**: Legitimate COM CLSID InprocServer32 path replaced with malicious DLL.
1045. **IFEO Debugger Injection**: Image File Execution Options key set with debugger pointing to implant for common utilities.
105
106## Output Format
107
108```
109Hunt ID: TH-PERSIST-[DATE]-[SEQ]
110Persistence Type: [Registry/Service/Task/WMI/COM/Other]
111MITRE Technique: T1547.xxx / T1543.xxx / T1053.xxx
112Location: [Full registry key / service name / task path]
113Value: [Binary path / command line]
114Host(s): [Affected endpoints]
115Signed: [Yes/No]
116Hash: [SHA256]
117Creation Time: [Timestamp]
118Risk Level: [Critical/High/Medium/Low]
119Verdict: [Malicious/Suspicious/Benign]
120```