Skip to content
Pwnversity
MAL-PERSISTadvanced · 8 min · upd. 2026-10

Malware Persistence (analysis)

T1547T1543T1053T1546

Persistence is how malware survives reboots and logoffs to keep access. When analyzing a sample, identifying its persistence mechanism is key: it says where it “lives” in the system, provides high-fidelity IOCs, and is the first thing to clean in incident response. This page catalogs Windows mechanisms from the analysis, detection, and cleanup angle. (Linux persistence is covered in Linux persistence; AD in Active Directory persistence.)

Persistence is a trade-off for the adversary: the more reliable and automatic, the more noise it leaves (a Run key is trivial to plant and trivial to find); the stealthier, the more privilege and complexity it demands (a WMI subscription or a bootkit). The defender exploits exactly that: almost every legitimate autostart mechanism is inventoried and enumerable, so a known-good baseline makes persistence one of the most detectable phases of the chain. The golden rule of response: if one mechanism goes undetected, the malware comes back.

flowchart TD
  U[No privileges / user] --> U1[HKCU Run / RunOnce]
  U --> U2[Startup folder]
  U --> U3[User scheduled task]
  U --> U4[COM hijacking HKCU]
  A[Privileged / admin-SYSTEM] --> A1[Service]
  A --> A2[HKLM Run / IFEO]
  A --> A3[WMI event subscription]
  A --> A4[LSA / Winlogon / AppInit]
  K[Kernel / boot] --> K1[Driver / rootkit]
  K --> K2[UEFI bootkit]

Mechanisms: what each touches and why it matters

Section titled “Mechanisms: what each touches and why it matters”

Values in HKCU\...\CurrentVersion\Run (user) or HKLM\...\Run (all). Read by explorer.exe/userinit at logon. The most common and noisiest mechanism: instantly visible in Autoruns. ATT&CK T1547.001. High-fidelity IOC: the exact (value name, command) pair, which usually reveals paths and LOLBins.

A shortcut or script in the user’s or system’s startup folder. Equally visible; sometimes chained with a .lnk launching an interpreter.

Task Scheduler entries created by schtasks, PowerShell (Register-ScheduledTask), or the COM API ITaskService. Heavily used because they allow flexible triggers (at boot, on connect, every N minutes) and blend in with legitimate tasks. ATT&CK T1053.005. Artifacts: XML in C:\Windows\System32\Tasks\ and the ...\TaskCache\Tree key.

A service that starts with the system (CreateService, or an entry in HKLM\SYSTEM\CurrentControlSet\Services). Can point to an EXE or a DLL loaded by svchost. Requires admin/SYSTEM privileges. ATT&CK T1543.003. Clear signal: event 7045 (new service installed).

An EventFilter + EventConsumer + FilterToConsumerBinding trio that triggers code on a system event (e.g. at boot). Stealthy because it leaves no binary in the classic paths and lives in the WMI repository. ATT&CK T1546.003. Analyzed by reading the root\subscription namespace.

Hijacking a poorly watched COM key (CLSID) —typically in HKCU, which precedes HKLM— so a legitimate application loads the attacker’s DLL when instantiating that object. Stealthy and without admin privileges. ATT&CK T1546.015.

Placing a DLL with the name a signed application looks for, in a path resolved before the legitimate one. The trusted app loads the attacker’s code — widely used to evade allowlisting. ATT&CK T1574.001/002.

Keys that inject DLLs or launch processes in system contexts: Image File Execution Options (a “debugger” tied to an EXE intercepts it), AppInit_DLLs, LSA authentication packages, Winlogon\Shell/Userinit. Powerful and deep; several require SYSTEM. ATT&CK T1546.012, T1547.002/004.

Malicious drivers, rootkits, and UEFI bootkits persist beneath the OS. They’re the stealthy extreme and the hardest to eradicate: covered in Rootkits and bootkits.

In an authorized exercise, the value isn’t “planting” persistence but checking whether the blue team sees it. The operator picks a mechanism consistent with the emulated adversary, deploys it within scope, and measures how long detection takes and whether response removes it completely. Emulation frameworks like Atomic Red Team cover every TA0003 technique with reproducible tests — also useful for the defender to validate detections. The deliverable is the map of which mechanisms were detected and which slipped through, not “I persisted.”

  • Autoruns (Sysinternals) enumerates all autostart points at a glance; compare against a known-good baseline and what’s added stands out.
  • Pattern hunting: tasks/services with obfuscated commands or invoking interpreters/LOLBins; unsigned DLLs loaded from user paths; HKCU CLSIDs shadowing HKLM.
  • WMI subscriptions: periodically enumerate root\subscription and alert on new consumers.
  • Sysmon: process created (1), file create (11), registry (12/13/14), image load (7), and the WMI-specific events (19/20/21 — WmiEventFilter/Consumer/Binding).
  • Windows: 7045 (new service), 4698 (task created), 4697 (service installed, Security), 4657 (registry value change).
title: New Run-key value invoking an interpreter
logsource:
product: windows
category: registry_set
detection:
selection_path:
TargetObject|contains:
- '\CurrentVersion\Run\'
- '\CurrentVersion\RunOnce\'
selection_susp:
Details|contains:
- 'powershell'
- 'mshta'
- 'rundll32'
- 'cmd /c'
- '-enc'
condition: selection_path and selection_susp
level: high
  1. Identify all mechanisms (usually several/redundant): Autoruns + review of tasks, services, WMI, COM.
  2. Remove malicious keys/tasks/services/DLLs and the persisted payload.
  3. Verify by re-running autoruns; on serious compromise or rootkit suspicion, rebuild the host.
  • WMI subscriptions are a persistence hallmark of APT29 and many espionage campaigns due to their fileless stealth.
  • DLL sideloading against signed applications is a recurring TTP of Chinese groups (e.g. PlugX loaded by legitimate binaries).
  • Scheduled tasks with names mimicking Microsoft are a classic of commodity malware (Qakbot, AsyncRAT).
  • ATT&CK: tactic TA0003 (Persistence) with the techniques cited above (T1547, T1543, T1053, T1546, T1574).
  • Autoruns/Regshot before and after running the sample
  • Identify all installed mechanisms (don’t stop at the first)
  • Imports/strings that reveal the mechanism (static: CreateService, ITaskService, IWbemServices)
  • Extract exact IOCs (key/task/service/path/command)
  • Any stealthy mechanisms (WMI/COM/IFEO/sideloading)?
  • Derive detections (Sigma: 7045/4698/Run keys; Sysmon WMI 19-21)
  • Map to MITRE ATT&CK (TA0003)
  • Cleanup plan (all mechanisms → payload → verify)