Skip to content

Lesson 19 of 19 · 24m

Every Way Back In: Enumerating Persistence Before You Evict

The autostart-extensibility-point survey — registry ASEPs, IFEO and COM hijacks, scheduled-task caches, WMI subscriptions, LSASS-tier providers — that determines whether your eviction actually holds.

The containment call goes badly in a specific way: you pull the box, reimage it, rotate the credentials — and three days later the attacker is back through a WMI subscription nobody enumerated. Partial evictions announce themselves. Every persistence mechanism you missed is a foothold that watched you clean the others. Enumeration belongs in the scoping phase, and eviction happens once, in one window, after the list is complete.

The registry ASEPs

Windows' autostart extensibility points — the places the OS auto-loads code — cluster in the registry:

  • Run, RunOnce, RunOnceEx, Policies\Explorer\Run across HKLM and HKCU, plus the Wow6432Node shadows and HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Load and Run.
  • Winlogon Userinit, Shell, and AppInit_DLLs — AppInit is dead on SecureBoot machines, which is itself worth knowing before you burn time checking it.
  • Per-user and all-users startup folders, shell Folder hijacks, file-association hijacks on exefile.

The hijack tier: code loaded by other programs' mechanics

  • IFEO: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\<name>\Debugger launches the debugger instead of the named binary — persistence and a kill switch for security tools in one. GlobalFlag + VerifierDlls and SilentProcessExit monitors are the quieter siblings.
  • COM hijacking: a CLSID registered under HKCU\Software\Classes\CLSID shadows the machine-wide one for that user — persistence with no admin rights and no Run key.
  • DLL search-order: a phantom DLL placed where an application searches for a missing import loads on every launch — the classic side-load the implant vendors ship by default.
  • AppCertDlls under Session Manager injects a DLL into every process that calls CreateProcess. COR_PROFILER environment persistence loads into every .NET process started in that context.

Scheduled tasks and services

schtasks /query /v shows the visible surface; the TaskCache registry tree (HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache) is the durable copy and survives desyncs — tasks deleted from files can linger there. Event-triggered tasks fire on specific EventIDs and look empty to a casual query. On the service side, check ServiceDll parameters for svchost-hosted DLL services, registry residue from services removed from the SCM database, and kernel-driver entries — 4697/7045 log the installs if the events still exist.

WMI subscriptions and the LSASS tier

WMI permanent event subscriptions live in root\subscription as three bound objects — __EventFilter, a CommandLineEventConsumer or ActiveScriptEventConsumer, and __FilterToConsumerBinding — no file on disk, self-rearming, invisible to older Autoruns versions. Enumerate with Get-WmiObject -Namespace root\subscription -Class __EventFilter (and the two sibling classes). The LSASS tier — Security Packages, Authentication Packages, Notification Packages under HKLM\SYSTEM\CurrentControlSet\Control\Lsa, osconfig LSA extensions, W32Time time providers, print monitors, netsh add helper DLLs — loads attacker code into or beside the credential subsystem itself, which is the scariest persistence placement that exists. User-tier persistence rounds it out: Office WLL/XLL addins, VbaProject.OTM, PowerShell profile files, browser extensions.

Enumerate at scale, then evict once

autorunsc -a * -ct (the Autoruns CLI) dumps every ASEP to TSV; sigcheck -u filters to unsigned entries. At fleet scale the pattern is a per-build golden baseline plus diff-on-incident — every persistence mechanism is an addition, and additions diff cleanly. KAPE's triage targets pull the same registry hives for offline parsing when the box is already imaged.

Tag each finding with its MITRE technique (T1543 services, T1546 event hijacks and IFEO, T1547 registry ASEPs, T1137 Office addins, T1176 extensions) so the postmortem carries the complete foothold inventory rather than "malware persisted." Then — and only then — the eradication window removes all of them at once: credentials rotated, mechanisms pulled, box reimaged if the footholds reached LSASS depth. A foothold in Lsa\Security Packages survives a Run-key cleanup and a password reset alike, which is why the depth of what you found determines how far the eviction has to go. Anything less and you're scheduling the re-entry for them.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.