Malware rarely installs one persistence mechanism; it installs a primary and one or two fallbacks, because defenders clean the obvious one. Incomplete persistence enumeration is how reinfections happen: the Run key gets deleted, the scheduled task brings the payload back. This sub-skill covers finding all of them, in the order installed, and verifying removal. Scope: analyze persistence only from samples you are authorized to handle, in isolated labs, during authorized DFIR or incident response. On live infected hosts, follow your incident response plan; this skill informs it but does not replace containment procedure.
Quick Workflow
- From the trace, list every persistence-relevant write in timestamp order (registry, tasks, services, files).
- Classify each by mechanism and ATT&CK ID.
- Check for the mechanisms the trace might have missed (WMI, COM hijack) with targeted hunts.
- Record install order and identify primary vs fallback.
- Write the removal checklist: every mechanism, with verification.
- Convert each mechanism to a detection.
1. Registry persistence
Common keys (trace these writes):
HKCU\Software\Microsoft\Windows\CurrentVersion\Run
HKLM\Software\Microsoft\Windows\CurrentVersion\Run
HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce
HKLM\SYSTEM\CurrentControlSet\Services\<name> (services)
HKCU\Software\Classes\<progid>\shell\open\command (COM/file hijack)
Trace shape:
RegCreateKeyEx(HKCU\...\Run) -> RegSetValueEx("NimbusSync",
"rundll32.exe C:\Users\x\AppData\Local\Temp\pay.dll,Run")
Also watch Winlogon keys (Userinit, Shell) and AppInit_DLLs: rarer but higher privilege. In the trace, registry persistence is a RegSetValueEx with a path to the payload; capture the value name and the exact command line, since defenders need both to remove and detect.
2. Scheduled tasks and services
Scheduled task trace shapes:
schtasks.exe /create /tn "NimbusUpdate" ... (child process)
COM: ITaskService::NewTask + RegisterTaskDefinition (in-process)
Service trace shapes:
CreateServiceW("NimbusSvc", ..., SERVICE_AUTO_START, ...)
RegSetValueEx(HKLM\SYSTEM\...\Services\NimbusSvc\ImagePath, ...)
Tasks and services survive user logoff and often run as SYSTEM. Record the task name, trigger (logon, minute schedule), the action command, and the service name, display name, and ImagePath. A service with an ImagePath pointing to Temp or AppData is the classic malicious shape.
3. Startup folder, WMI, and hijacks
Startup folder:
CopyFile/MoveFile -> ...\Start Menu\Programs\Startup\update.lnk
(.lnk pointing at the payload; check the link target, not just the name)
WMI event subscription:
IWbemServices::PutInstance(__EventFilter) +
PutInstance(CommandLineEventConsumer) +
PutInstance(__FilterToConsumerBinding)
-> triggers on events like logon or timers; invisible in
Autoruns' default view
DLL/COM hijacking:
payload placed where a legitimate app loads it by search order
(trace: WriteFile to a directory in the DLL search path of a
startup program)
WMI persistence is the one most often missed: add an explicit hunt for
PutInstance with __EventFilter in every persistence review. For
hijacks, the persistence is the file placement plus the victim
application's startup; document both halves.
4. Install order and fallback analysis
Example ordered findings:
T+3s HKCU Run key "NimbusSync" (primary, user level)
T+4s Scheduled task "NimbusUpdate" /sc minute (fallback 1)
T+5s WMI subscription "NimbusFilter" (fallback 2, stealthy)
Read: primary is the noisy Run key; if defenders clean it, the
minute-schedule task restores the payload within 60 seconds, and the
WMI subscription survives even task deletion.
Order reveals priority: the first mechanism is usually the primary, later ones are fallbacks. But verify: sometimes the first write is a decoy. The removal plan must cover all of them atomically (remove in one maintenance window) or the fallbacks resurrect the primary.
5. Removal verification
# After cleanup, verify each mechanism is gone and stays gone
# Registry
reg query HKCU\Software\Microsoft\Windows\CurrentVersion\Run
# Tasks
schtasks /query /tn "NimbusUpdate" # expect: not found
# Services
sc query NimbusSvc # expect: not found
# WMI
wmic /NAMESPACE:\\root\subscription PATH __EventFilter GET Name
# Then reboot and re-check: nothing should have returned
Verification is two-pass: immediately after removal, and after a reboot. Anything that returns after reboot means a mechanism was missed; go back to the trace. Document the verification output in the incident record.
Edge cases
- Persistence via legitimate tools (GPO, SCCM abuse): the mechanism looks administrative; correlate with the infection timeline.
- Time-triggered tasks set far in the future: easy to miss in short detonations; review task triggers, not just task creation.
- Persistence that requires a reboot to activate (RunOnce): detonate with a reboot step or simulate it.
- User vs system context: HKCU persistence only affects one user; check all user hives on a real host.
- Bootkits: persistence below the OS; signs include MBR/VBR writes or UEFI variable changes. Escalate immediately.
Escalation
If persistence involves boot components (MBR, UEFI), escalate: that is beyond OS-level cleanup and may need reimaging.
If the host is a production server, persistence removal happens under the incident response plan with change control, not ad hoc.
If fallback mechanisms keep reappearing after verified removal, assume an additional unseen mechanism and re-analyze rather than repeating the same cleanup.
If persistence reappears from an unknown mechanism after verified cleanup, escalate to memory forensics on the host before repeating cleanup.
Detection and defender view
Write one detection per mechanism, not one per sample: a Sigma rule for Run key writes with Temp paths, one for suspicious scheduled task creation, one for WMI subscription events. Baseline normal persistence in your environment first (management tools create tasks and services constantly); detections must exclude the known-good. The install-order finding feeds prioritization: detect the primary mechanism for speed, detect the stealthy fallback for completeness. Review persistence detections against MITRE ATT&CK T1547, T1053, T1543, T1546 coverage maps quarterly.
Key references
MITRE ATT&CK: T1547 (Boot or Logon Autostart Execution), T1053 (Scheduled Task/Job), T1543 (Create or Modify System Process), T1546 (Event Triggered Execution)
Sysinternals Autoruns (persistence enumeration): https://learn.microsoft.com/en-us/sysinternals/downloads/autoruns
Volatility 3 (memory persistence artifacts): https://volatility3.readthedocs.io/
Sigma specification: https://github.com/SigmaHQ/sigma
MITRE ATT&CK T1547.001 (Registry Run Keys): https://attack.mitre.org/techniques/T1547/001/
