security analyst security skill risk: medium
Registry Run Key Persistence Detection Guide
Provides steps to collect and analyze Sysmon Event ID 13 logs for registry Run/RunOnce key modifications, flag suspicious values and processes, chain with other events, and output…
SKILL 4 files · 2 folders
SKILL.md
--- name: hunting-for-registry-run-key-persistence description: "Detect MITRE ATT&CK T1547.001 registry Run key persistence by analyzing Sysmon Event ID 13 logs and registry" --- # Hunting for Registry Run Key Persistence ## Overview Registry Run keys (T1547.001) are one of the most commonly used persistence mechanisms by adversaries. When a program is added to a Run key in the Windows registry, it executes automatically when a user logs in. Attackers abuse keys under `HKLM\Software\Microsoft\Windows\CurrentVersion\Run`, `HKCU\Software\Microsoft\Windows\CurrentVersion\Run`, and their RunOnce counterparts to maintain persistence. Sysmon Event ID 13 (RegistryEvent - Value Set) captures registry value modifications including the target object path, the process that made the change, and the new value. Detection involves monitoring these events for suspicious executables in temp directories, encoded PowerShell commands, LOLBin paths, and processes that do not normally create Run key entries. Chaining Event 13 with Event 1 (Process Creation) and Event 11 (FileCreate) strengthens detection by confirming payload creation and execution. ## When to Use - When investigating security incidents that require hunting for registry run key persistence - When building detection rules or threat hunting queries for this domain - When SOC analysts need structured procedures for this analysis type - When validating security monitoring coverage for related attack techniques ## Prerequisites - Windows systems with Sysmon installed and configured to log Event ID 13 - Sysmon config with RegistryEvent rules for Run/RunOnce keys - Python 3.9+ with `json`, `xml.etree.ElementTree`, `re` modules - SIEM or log aggregator collecting Sysmon logs (Splunk, Elastic, Sentinel) - Knowledge of legitimate auto-start programs for baseline comparison ## Steps 1. Collect Sysmon Event ID 13 logs filtered for Run/RunOnce key paths 2. Parse event XML/JSON for TargetObject, Details (value written), Image (modifying process) 3. Flag entries where the value points to temp directories, AppData, or ProgramData 4. Detect encoded PowerShell commands or script interpreters in registry values 5. Identify LOLBin abuse (mshta.exe, rundll32.exe, regsvr32.exe, wscript.exe) 6. Compare against known-good baseline of legitimate auto-start entries 7. Check if the modifying process (Image) is unusual (cmd.exe, powershell.exe, python.exe) 8. Chain with Event ID 1 to verify if the registered binary was recently created 9. Generate detection report with MITRE ATT&CK mapping and severity scores 10. Produce Sigma/Splunk detection rules from findings ## Expected Output A JSON report listing suspicious Run key entries with the registry path, value written, modifying process, timestamp, MITRE technique mapping, severity rating, and recommended Sigma detection rules.
REQUIRED CONTEXT
- Sysmon Event ID 13 logs filtered for Run/RunOnce key paths
OPTIONAL CONTEXT
- Event ID 1 and Event ID 11 logs
- known-good baseline of legitimate auto-start entries
EXPECTED OUTPUT
- Format
- json
- Schema
- json_schema · registry path, value written, modifying process, timestamp, MITRE technique mapping, severity rating, recommended Sigma detection rules
- Constraints
- list suspicious Run key entries
- include registry path, value written, modifying process, timestamp, MITRE technique mapping, severity rating, recommended Sigma detection rules
SUCCESS CRITERIA
- Produce JSON report listing suspicious Run key entries
- Include MITRE ATT&CK mapping and severity scores
- Produce Sigma/Splunk detection rules
CAVEATS
- Dependencies
- Windows systems with Sysmon installed and configured to log Event ID 13
- Sysmon config with RegistryEvent rules for Run/RunOnce keys
- Python 3.9+ with `json`, `xml.etree.ElementTree`, `re` modules
- SIEM or log aggregator collecting Sysmon logs (Splunk, Elastic, Sentinel)
- Knowledge of legitimate auto-start programs for baseline comparison
- Missing context
- Exact input log format or sample data
- Definition or examples of 'known-good baseline'
QUALITY
- OVERALL
- 0.78
- CLARITY
- 0.90
- SPECIFICITY
- 0.75
- REUSABILITY
- 0.80
- COMPLETENESS
- 0.70
IMPROVEMENT SUGGESTIONS
- Add a sample Sysmon Event ID 13 JSON/XML snippet to illustrate parsing
- Specify the exact JSON schema for the expected output report
USAGE
Copy the prompt above and paste it into your AI of choice — Claude, ChatGPT, Gemini, or anywhere else you're working. Replace any placeholder sections with your own context, then ask for the output.
MORE FOR SECURITY ANALYST
- Ransomware Network Indicators Analyzersecurity analystsecurity
- APT TTP Mapping with MITRE Navigatorsecurity analystsecurity
- Linux Persistence Mechanisms Analyzersecurity analystsecurity
- Azure AD Lateral Movement KQL Detectorsecurity analystsecurity
- Kerberos Golden Ticket Forgery Detectorsecurity analystsecurity
- LOLBAS Abuse Detection with Sigma Rulessecurity analystsecurity
- Shadow IT Cloud Usage Detectorsecurity analystsecurity
- Detect Risky OAuth Consent Grants in Entra IDsecurity analystsecurity
- Windows Service Installation Threat Huntersecurity analystsecurity
- Web Server Log Intrusion Analyzersecurity analystsecurity
- RDP Brute Force Event Log Analyzersecurity analystsecurity
- Rekall Memory Forensics Artifact Extractorsecurity analystsecurity
- Azure Activity Logs Threat Analyzersecurity analystsecurity
- Scapy Network Packet Analysis Guidesecurity analystsecurity
- TLS Certificate Transparency Log Analyzersecurity analystsecurity
- Cobalt Strike Malleable C2 Profile Analyzersecurity analystsecurity
- Email Account Compromise Detection Proceduressecurity analystsecurity
- Credential Stuffing Auth Log Analyzersecurity analystsecurity
- MISP Threat Intelligence Sharing with PyMISPsecurity analystsecurity
- MISP Threat Landscape Analysis Guidesecurity analystsecurity
- Malicious Scheduled Task Sysmon Detectorsecurity analystsecurity
- Kerberos Pass-the-Ticket Attack Detectorsecurity analystsecurity
- NTLM Relay Attack Event Log Analyzersecurity analystsecurity
- Linux Memory Forensics with LiME and Volatilitysecurity analystsecurity
- Insider Data Exfiltration DLP Analyzersecurity analystsecurity