1---2name: hunting-for-persistence-mechanisms-in-windows3description: Systematically hunts for adversary persistence mechanisms4version: '1.0'5author: mahipal (vendored by SOCIS)6license: Apache-2.07platforms:8- linux9- macos10- windows11category: security12metadata:13 source: https://skillmd.com/skills/socisio/hunting-for-persistence-mechanisms-in-windows14 socis:15 tags:16 - threat-hunting17 - mitre-attack18 - persistence19 - windows20 - registry21 - siem22 - proactive-detection23 subdomain: threat-hunting24 upstream: mukul975/Anthropic-Cybersecurity-Skills25 nist_csf:26 - DE.CM-0127 - DE.AE-0228 - DE.AE-0729 - ID.RA-0530 d3fend_techniques:31 - Executable Denylisting32 - Execution Isolation33 - File Metadata Consistency Validation34 - Content Format Conversion35 - File Content Analysis36 mitre_attack:37 - T104638 - T105739 - T108240 - T108341 - T154742---434445# Hunting for Persistence Mechanisms in Windows4647## When to Use4849- During periodic proactive threat hunts for dormant backdoors50- After an incident to identify all persistence mechanisms an attacker planted51- When investigating unusual services, scheduled tasks, or startup entries52- When threat intel reports describe new persistence techniques in the wild53- During security posture assessments to identify unauthorized persistent software5455## Prerequisites5657- Sysmon deployed with Event IDs 12/13/14 (Registry), 19/20/21 (WMI), 1 (Process Creation)58- Windows Security Event forwarding for 4697 (Service Install), 4698 (Scheduled Task)59- EDR with registry and file monitoring capabilities60- PowerShell script block logging enabled (Event ID 4104)61- Autoruns or equivalent baseline of legitimate persistent entries6263## Workflow64651. **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).662. **Collect Endpoint Data**: Use EDR, Sysmon, or Velociraptor to collect current persistence artifacts from endpoints across the environment.673. **Baseline Legitimate Persistence**: Compare collected data against known-good baselines (Autoruns snapshots, GPO-deployed entries, SCCM configurations).684. **Identify Anomalies**: Flag new, unsigned, or unknown entries in persistence locations that deviate from the baseline.695. **Investigate Suspicious Entries**: For each anomaly, examine the binary it points to, its digital signature, file hash, and creation timestamp.706. **Correlate with Process Activity**: Link persistence entries to process execution, network activity, and user login events.717. **Document and Remediate**: Record findings, remove malicious persistence, and update detection rules.7273## Key Concepts7475| Concept | Description |76|---------|-------------|77| T1547.001 | Registry Run Keys / Startup Folder |78| T1543.003 | Windows Service (Create or Modify) |79| T1053.005 | Scheduled Task |80| T1546.003 | WMI Event Subscription |81| T1546.015 | Component Object Model (COM) Hijacking |82| T1546.012 | Image File Execution Options Injection |83| T1546.010 | AppInit DLLs |84| T1547.004 | Winlogon Helper DLL |85| T1547.005 | Security Support Provider |86| T1574.001 | DLL Search Order Hijacking |87| TA0003 | Persistence Tactic |88| Autoruns | Sysinternals tool showing persistent entries |8990## Tools & Systems9192| Tool | Purpose |93|------|---------|94| Sysinternals Autoruns | Comprehensive persistence enumeration |95| Velociraptor | Endpoint-wide persistence artifact collection |96| CrowdStrike Falcon | Real-time persistence monitoring |97| Sysmon | Registry and WMI event monitoring |98| OSQuery | SQL-based persistence queries |99| RECmd | Registry Explorer for forensic analysis |100| Splunk | SIEM correlation of persistence events |101102## Common Scenarios1031041. **Registry Run Key Backdoor**: Malware adds `HKCU\Software\Microsoft\Windows\CurrentVersion\Run` entry pointing to payload in `%APPDATA%`.1052. **WMI Event Subscription**: Adversary creates WMI consumer/filter pair that executes PowerShell on system boot.1063. **Malicious Service**: Attacker creates Windows service with `sc create` pointing to a backdoor binary.1074. **COM Object Hijack**: Legitimate COM CLSID InprocServer32 path replaced with malicious DLL.1085. **IFEO Debugger Injection**: Image File Execution Options key set with debugger pointing to implant for common utilities.109110## Output Format111112```113Hunt ID: TH-PERSIST-[DATE]-[SEQ]114Persistence Type: [Registry/Service/Task/WMI/COM/Other]115MITRE Technique: T1547.xxx / T1543.xxx / T1053.xxx116Location: [Full registry key / service name / task path]117Value: [Binary path / command line]118Host(s): [Affected endpoints]119Signed: [Yes/No]120Hash: [SHA256]121Creation Time: [Timestamp]122Risk Level: [Critical/High/Medium/Low]123Verdict: [Malicious/Suspicious/Benign]124```