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---67# Hunting for Persistence Mechanisms in Windows89## When to Use1011- During periodic proactive threat hunts for dormant backdoors12- After an incident to identify all persistence mechanisms an attacker planted13- When investigating unusual services, scheduled tasks, or startup entries14- When threat intel reports describe new persistence techniques in the wild15- During security posture assessments to identify unauthorized persistent software1617## Prerequisites1819- 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 capabilities22- PowerShell script block logging enabled (Event ID 4104)23- Autoruns or equivalent baseline of legitimate persistent entries2425## Workflow26271. **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.3435## Key Concepts3637| 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 |5152## Tools & Systems5354| 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 |6364## Common Scenarios65661. **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.7172## Output Format7374```75Hunt ID: TH-PERSIST-[DATE]-[SEQ]76Persistence Type: [Registry/Service/Task/WMI/COM/Other]77MITRE Technique: T1547.xxx / T1543.xxx / T1053.xxx78Location: [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```