Analyzing Malware Persistence with Autoruns
Overview
Sysinternals Autoruns extracts data from hundreds of Auto-Start Extensibility Points (ASEPs) on Windows, scanning 18+ categories including Run/RunOnce keys, services, scheduled tasks, drivers, Winlogon entries, LSA providers, print monitors, WMI subscriptions, and AppInit DLLs. Digital signature verification filters Microsoft-signed entries. The compare function identifies newly added persistence via baseline diffing. VirusTotal integration checks hash reputation. Offline analysis via -z flag enables forensic disk image examination.
When to Use
- When investigating security incidents that require analyzing malware persistence with autoruns
- 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
Detection Gaps & Validation
- Autoruns doesn't cover every ASEP. COM hijacking, certain WMI event-consumer subscriptions, and fully fileless/in-memory persistence may not surface. Corroborate with Sysmon (Event IDs 12-13, 19-21),
wmic/Get-WmiObject for __EventConsumer, and Volatility for memory-only implants.
- Live runs can be lied to. A rootkit on the running host can hide its own autostart entry; prefer offline analysis with
autorunsc -z against a mounted disk image, then diff against a clean baseline.
- Signed != trusted. Malware abuses signed LOLBins (
regsvr32, mshta, rundll32) and can sit behind a valid Microsoft signature; "Hide Microsoft entries" can mask a binary masquerading from System32. Verify the signature is valid (not just present) and that the path/name match the real product.
- Confirm a hit: check the hash on VirusTotal, validate the digital-signature state, confirm the launch string/path against a known-good baseline, and corroborate the entry from a second source (Sysmon, raw registry hive, scheduled-task XML) rather than Autoruns alone.
- False positives: legitimate line-of-business apps, OEM utilities, and dev tools are often unsigned, run from odd paths, or use script launchers. Require corroborating indicators before flagging an unsigned entry.
Prerequisites
- Sysinternals Autoruns (GUI) and Autorunsc (CLI)
- Administrative privileges on target system
- Python 3.9+ for automated analysis
- VirusTotal API key for reputation checks
- Clean baseline export for comparison
Workflow
Step 1: Automated Persistence Scanning
#!/usr/bin/env python3
"""Automate Autoruns-based persistence analysis."""
import subprocess
import csv
import json
import sys
def scan_and_analyze(autorunsc_path="autorunsc64.exe", csv_path="scan.csv"):
cmd = [autorunsc_path, "-a", "*", "-c", "-h", "-s", "-nobanner", "*"]
result = subprocess.run(cmd, capture_output=True, text=True, timeout=600)
with open(csv_path, 'w') as f:
f.write(result.stdout)
return parse_and_flag(csv_path)
def parse_and_flag(csv_path):
suspicious = []
with open(csv_path, 'r', errors='replace') as f:
for row in csv.DictReader(f):
reasons = []
signer = row.get("Signer", "")
if not signer or signer == "(Not verified)":
reasons.append("Unsigned binary")
if not row.get("Description") and not row.get("Company"):
reasons.append("Missing metadata")
path = row.get("Image Path", "").lower()
for sp in ["\\temp\\", "\\appdata\\local\\temp", "\\users\\public\\"]:
if sp in path:
reasons.append(f"Suspicious path")
launch = row.get("Launch String", "").lower()
for kw in ["powershell", "cmd /c", "wscript", "mshta", "regsvr32"]:
if kw in launch:
reasons.append(f"LOLBin: {kw}")
if reasons:
row["reasons"] = reasons
suspicious.append(row)
return suspicious
if __name__ == "__main__":
if len(sys.argv) > 1:
results = parse_and_flag(sys.argv[1])
print(f"[!] {len(results)} suspicious entries")
for r in results:
print(f" {r.get('Entry','')} - {r.get('Image Path','')}")
for reason in r.get('reasons', []):
print(f" - {reason}")
Validation Criteria
- All ASEP categories scanned and cataloged
- Unsigned entries flagged for investigation
- Suspicious paths and LOLBin launch strings highlighted
- Baseline comparison identifies new persistence mechanisms
References
1---2name: analyzing-malware-persistence-with-autoruns3description: Use Sysinternals Autoruns to systematically identify and analyze malware persistence mechanisms across registry4 keys, scheduled tasks, services, drivers, and startup locations on Windows systems.5domain: cybersecurity6subdomain: malware-analysis7tags:8- autoruns9- persistence10- malware-analysis11- sysinternals12- windows13- registry14- startup15- incident-response16mitre_attack:17- T154718- T105319- T154320- T154621version: '1.0'22author: Krishna Kumar (xalgord)23license: Apache-2.024d3fend_techniques:25- Executable Denylisting26- Execution Isolation27- File Metadata Consistency Validation28- Content Format Conversion29- File Content Analysis30nist_csf:31- DE.AE-0232- RS.AN-0333- ID.RA-0134- DE.CM-0135metadata:36 source: https://skillmd.com/skills/xalgord/analyzing-malware-persistence-with-autoruns37---3839# Analyzing Malware Persistence with Autoruns4041## Overview4243Sysinternals Autoruns extracts data from hundreds of Auto-Start Extensibility Points (ASEPs) on Windows, scanning 18+ categories including Run/RunOnce keys, services, scheduled tasks, drivers, Winlogon entries, LSA providers, print monitors, WMI subscriptions, and AppInit DLLs. Digital signature verification filters Microsoft-signed entries. The compare function identifies newly added persistence via baseline diffing. VirusTotal integration checks hash reputation. Offline analysis via -z flag enables forensic disk image examination.444546## When to Use4748- When investigating security incidents that require analyzing malware persistence with autoruns49- When building detection rules or threat hunting queries for this domain50- When SOC analysts need structured procedures for this analysis type51- When validating security monitoring coverage for related attack techniques5253## Detection Gaps & Validation5455- **Autoruns doesn't cover every ASEP.** COM hijacking, certain WMI event-consumer subscriptions, and fully fileless/in-memory persistence may not surface. Corroborate with Sysmon (Event IDs 12-13, 19-21), `wmic`/`Get-WmiObject` for `__EventConsumer`, and Volatility for memory-only implants.56- **Live runs can be lied to.** A rootkit on the running host can hide its own autostart entry; prefer offline analysis with `autorunsc -z` against a mounted disk image, then diff against a clean baseline.57- **Signed != trusted.** Malware abuses signed LOLBins (`regsvr32`, `mshta`, `rundll32`) and can sit behind a valid Microsoft signature; "Hide Microsoft entries" can mask a binary masquerading from `System32`. Verify the signature is *valid* (not just present) and that the path/name match the real product.58- **Confirm a hit:** check the hash on VirusTotal, validate the digital-signature state, confirm the launch string/path against a known-good baseline, and corroborate the entry from a second source (Sysmon, raw registry hive, scheduled-task XML) rather than Autoruns alone.59- **False positives:** legitimate line-of-business apps, OEM utilities, and dev tools are often unsigned, run from odd paths, or use script launchers. Require corroborating indicators before flagging an unsigned entry.6061## Prerequisites6263- Sysinternals Autoruns (GUI) and Autorunsc (CLI)64- Administrative privileges on target system65- Python 3.9+ for automated analysis66- VirusTotal API key for reputation checks67- Clean baseline export for comparison6869## Workflow7071### Step 1: Automated Persistence Scanning7273```python74#!/usr/bin/env python375"""Automate Autoruns-based persistence analysis."""76import subprocess77import csv78import json79import sys808182def scan_and_analyze(autorunsc_path="autorunsc64.exe", csv_path="scan.csv"):83 cmd = [autorunsc_path, "-a", "*", "-c", "-h", "-s", "-nobanner", "*"]84 result = subprocess.run(cmd, capture_output=True, text=True, timeout=600)85 with open(csv_path, 'w') as f:86 f.write(result.stdout)87 return parse_and_flag(csv_path)888990def parse_and_flag(csv_path):91 suspicious = []92 with open(csv_path, 'r', errors='replace') as f:93 for row in csv.DictReader(f):94 reasons = []95 signer = row.get("Signer", "")96 if not signer or signer == "(Not verified)":97 reasons.append("Unsigned binary")98 if not row.get("Description") and not row.get("Company"):99 reasons.append("Missing metadata")100 path = row.get("Image Path", "").lower()101 for sp in ["\\temp\\", "\\appdata\\local\\temp", "\\users\\public\\"]:102 if sp in path:103 reasons.append(f"Suspicious path")104 launch = row.get("Launch String", "").lower()105 for kw in ["powershell", "cmd /c", "wscript", "mshta", "regsvr32"]:106 if kw in launch:107 reasons.append(f"LOLBin: {kw}")108 if reasons:109 row["reasons"] = reasons110 suspicious.append(row)111 return suspicious112113114if __name__ == "__main__":115 if len(sys.argv) > 1:116 results = parse_and_flag(sys.argv[1])117 print(f"[!] {len(results)} suspicious entries")118 for r in results:119 print(f" {r.get('Entry','')} - {r.get('Image Path','')}")120 for reason in r.get('reasons', []):121 print(f" - {reason}")122```123124## Validation Criteria125126- All ASEP categories scanned and cataloged127- Unsigned entries flagged for investigation128- Suspicious paths and LOLBin launch strings highlighted129- Baseline comparison identifies new persistence mechanisms130131## References132133- [Sysinternals Autoruns](https://learn.microsoft.com/en-us/sysinternals/downloads/autoruns)134- [SANS - Offline Autoruns Revisited](https://www.sans.org/blog/offline-autoruns-revisited-auditing-malware-persistence/)135- [Hunting Malware with Autoruns](https://nasbench.medium.com/hunting-malware-with-windows-sysinternals-autoruns-19cbfe4103c2)136- [MITRE ATT&CK T1547 - Boot or Logon Autostart](https://attack.mitre.org/techniques/T1547/)