1---2name: hunting-for-persistence-mechanisms-in-windows3description: Systematically hunts for adversary persistence mechanisms across Windows4 endpoints, covering registry Run/RunOnce keys, services, startup folders, scheduled5 tasks, and WMI event subscriptions. Use when performing a broad persistence sweep6 during incident response or building SIEM detections that cover the full range of7 Windows persistence techniques (MITRE T1547).8domain: cybersecurity9subdomain: threat-hunting10tags:11- threat-hunting12- mitre-attack13- persistence14- windows15- registry16- siem17- proactive-detection18version: '1.0'19author: mahipal20license: Apache-2.021d3fend_techniques:22- Executable Denylisting23- Execution Isolation24- File Metadata Consistency Validation25- Content Format Conversion26- File Content Analysis27nist_csf:28- DE.CM-0129- DE.AE-0230- DE.AE-0731- ID.RA-0532mitre_attack:33- T104634- T105735- T108236- T108337- T154738metadata:39 source: https://skillmd.com/skills/26zl/hunting-for-persistence-mechanisms-in-windows40---4142# Hunting for Persistence Mechanisms in Windows4344## When to Use4546- During periodic proactive threat hunts for dormant backdoors47- After an incident to identify all persistence mechanisms an attacker planted48- When investigating unusual services, scheduled tasks, or startup entries49- When threat intel reports describe new persistence techniques in the wild50- During security posture assessments to identify unauthorized persistent software5152## Prerequisites5354- Sysmon deployed with Event IDs 12/13/14 (Registry), 19/20/21 (WMI), 1 (Process Creation)55- Windows Security Event forwarding for 4697 (Service Install), 4698 (Scheduled Task)56- EDR with registry and file monitoring capabilities57- PowerShell script block logging enabled (Event ID 4104)58- Autoruns or equivalent baseline of legitimate persistent entries5960## Workflow61621. **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).632. **Collect Endpoint Data**: Use EDR, Sysmon, or Velociraptor to collect current persistence artifacts from endpoints across the environment.643. **Baseline Legitimate Persistence**: Compare collected data against known-good baselines (Autoruns snapshots, GPO-deployed entries, SCCM configurations).654. **Identify Anomalies**: Flag new, unsigned, or unknown entries in persistence locations that deviate from the baseline.665. **Investigate Suspicious Entries**: For each anomaly, examine the binary it points to, its digital signature, file hash, and creation timestamp.676. **Correlate with Process Activity**: Link persistence entries to process execution, network activity, and user login events.687. **Document and Remediate**: Record findings, remove malicious persistence, and update detection rules.6970## Key Concepts7172| Concept | Description |73|---------|-------------|74| T1547.001 | Registry Run Keys / Startup Folder |75| T1543.003 | Windows Service (Create or Modify) |76| T1053.005 | Scheduled Task |77| T1546.003 | WMI Event Subscription |78| T1546.015 | Component Object Model (COM) Hijacking |79| T1546.012 | Image File Execution Options Injection |80| T1546.010 | AppInit DLLs |81| T1547.004 | Winlogon Helper DLL |82| T1547.005 | Security Support Provider |83| T1574.001 | DLL Search Order Hijacking |84| TA0003 | Persistence Tactic |85| Autoruns | Sysinternals tool showing persistent entries |8687## Tools & Systems8889| Tool | Purpose |90|------|---------|91| Sysinternals Autoruns | Comprehensive persistence enumeration |92| Velociraptor | Endpoint-wide persistence artifact collection |93| CrowdStrike Falcon | Real-time persistence monitoring |94| Sysmon | Registry and WMI event monitoring |95| OSQuery | SQL-based persistence queries |96| RECmd | Registry Explorer for forensic analysis |97| Splunk | SIEM correlation of persistence events |9899## Common Scenarios1001011. **Registry Run Key Backdoor**: Malware adds `HKCU\Software\Microsoft\Windows\CurrentVersion\Run` entry pointing to payload in `%APPDATA%`.1022. **WMI Event Subscription**: Adversary creates WMI consumer/filter pair that executes PowerShell on system boot.1033. **Malicious Service**: Attacker creates Windows service with `sc create` pointing to a backdoor binary.1044. **COM Object Hijack**: Legitimate COM CLSID InprocServer32 path replaced with malicious DLL.1055. **IFEO Debugger Injection**: Image File Execution Options key set with debugger pointing to implant for common utilities.106107## Output Format108109```110Hunt ID: TH-PERSIST-[DATE]-[SEQ]111Persistence Type: [Registry/Service/Task/WMI/COM/Other]112MITRE Technique: T1547.xxx / T1543.xxx / T1053.xxx113Location: [Full registry key / service name / task path]114Value: [Binary path / command line]115Host(s): [Affected endpoints]116Signed: [Yes/No]117Hash: [SHA256]118Creation Time: [Timestamp]119Risk Level: [Critical/High/Medium/Low]120Verdict: [Malicious/Suspicious/Benign]121```