National Cyber Warfare Foundation (NCWF)login

The anatomy of persistence: a conceptual map of how attackers outlive reboots on compromised hosts


0 user ratings
2026-11-21 05:29:29
milo
Red Team (CNA)
"The

A defensive, educational tour of persistence mechanisms on compromised hosts — from cron and systemd to WMI event subscriptions — and how authorized security teams detect each strategy.








Topicpersistence — attacker strategies for maintaining access to compromised hosts across reboots and credential rotation
CategoryPost-exploitation tradecraft analysis
Primary UseThreat-informed detection engineering: mapping persistence surfaces so defenders and authorized red teams can prioritize audit coverage
Safe UseEducational, conceptual analysis for defenders and authorized security professionals operating in labs or sanctioned assessments; contains no operational procedures
Telemetry NoteMost persistence mechanisms leave durable artifacts — registry writes, unit files, scheduled tasks, authorized_keys changes — that are high-signal, low-noise detection sources

Persistence is the phase of an intrusion where an attacker stops being a transient visitor and becomes a resident. Every other stage of an operation — initial access, privilege escalation, lateral movement — can be repeated if it fails, but persistence is what converts a one-time compromise into durable control of a host. Conceptually, it answers one question: how do I guarantee that when my shell dies, my stolen credentials expire, or the machine reboots, I still have a way back in? Understanding the full taxonomy of answers to that question is foundational knowledge for defenders and authorized red teams alike, because persistence artifacts are among the most reliable forensic evidence an adversary leaves behind.


The first and most important conceptual divide is between userland persistence and root-or-SYSTEM persistence. A mechanism installed under a user account — a line appended to ~/.bashrc, an entry in the user's crontab, a rogue SSH key in authorized_keys — survives only as long as that account exists and only executes with that account's privileges. Mechanisms planted at the system level — a malicious systemd unit in /etc/systemd/system, a LaunchDaemon on macOS, a Windows service or WMI event subscription — survive reboots by design and typically run with elevated privileges. The elevation boundary matters enormously to defenders because system-level persistence is a direct confession that privilege escalation already succeeded; finding it means the intrusion timeline starts well before the artifact's timestamp.


The second organizing axis is execution trigger: what causes the persistent code to run. The scheduler family relies on time-based triggers — cron, at, Windows Task Scheduler entries created via schtasks or the ITaskService COM interface. The event family relies on system activity: udev rules that fire when hardware state changes, WMI event subscriptions that launch code on logon or process creation, PowerShell profile scripts that execute whenever an interactive shell opens. The boot family rides the startup sequence itself: systemd units, rc.local remnants, LaunchAgents and LaunchDaemons, the Windows Run and RunOnce registry keys, and startup folders. Each trigger class implies a different detection surface, which is precisely why mapping them conceptually is more useful to a defender than memorizing tool-specific tricks.


A third, subtler category is what might be called environmental persistence: rather than planting new artifacts, the adversary modifies the environment so that legitimate user behavior executes attacker code. Hijacking a writable directory that appears early in PATH, replacing a commonly typed alias, abusing LD_PRELOAD or DYLD_INSERT_LIBRARIES to intercept library resolution, or tampering with a development tool's extension or plugin directory all fall here. These techniques are prized by sophisticated operators because they generate no new binaries and often no new scheduled jobs — the malicious execution is camouflaged inside ordinary user activity. For detection engineers, this class argues for monitoring file integrity in configuration-heavy locations rather than only watching the classic autostart enumeration points.


Credential-based persistence deserves its own conceptual bucket because it does not involve code execution at all. A second administrative account quietly added to a system, an enrolled extra SSH public key, a golden-ticket-style abuse of Kerberos forging, a new OAuth grant or API token in a cloud console — these survive reboots trivially since they are simply state in an identity system. This class is why modern detection programs treat identity providers as persistence surfaces with the same seriousness as the operating system. A compromised host may be reimaged to gold-standard cleanliness while the attacker's foothold lives on entirely in Entra ID, AWS IAM, or the ticketing system's own integration tokens.


Application-layer persistence extends the map beyond the OS. Browsers, mail clients, and collaboration platforms have their own extension and add-on mechanisms that auto-load on launch; a malicious browser extension or an Office add-in is persistence that follows the user across machines if profile roaming is enabled. Containerized environments add yet another layer: a modified Dockerfile or entrypoint in a build pipeline, a patched base image in an internal registry, or an injected sidecar manifest in Kubernetes represents persistence at the infrastructure layer, invisible to host-level autostart enumeration entirely. The lesson of the conceptual map is that persistence lives wherever state lives, and state lives everywhere.


From a defensive standpoint, persistence is paradoxically the attacker's most dangerous mistake. Initial access is transient and often crosses the network in encrypted, ephemeral channels; persistence must, by definition, write durable state somewhere the operating system or application will read it again. That requirement converts the adversary's need into the defender's opportunity: autostart locations, scheduler tables, package manager states, and identity stores are all finite, enumerable, and diffable. Tools in the sysinternals family like Autoruns on Windows, or open-source auditors like osquery, chkrootkit-style scanners, and configuration-baseline comparators on Linux, exist precisely because this attack surface is enumerable. A host that snapshots its autostart state and diffs it daily catches most persistence within one cycle.


The telemetry signature of each class is worth internalizing. Scheduler abuse shows up as new rows in crontab files, /var/spool/cron, or Microsoft-Windows-TaskScheduler/Operational event logs. Registry-based persistence is visible through Sysmon event ID 13 (registry value set) filtered on the classic Run key hives, plus RunOnce, Image File Execution Options debugger hijacks, and AppInit_DLLs. systemd-based persistence writes unit files under /etc/systemd/system and then calls systemctl daemon-reload, an action that is itself loggable. WMI subscriptions persist inside the %SystemRoot%\System32\wbem\Repository store and appear in Microsoft-Windows-WMI-Activity/Operational logging. None of these require exotic tooling to monitor — only disciplined baselining.


MITRE ATT&CK captures this whole landscape as T1547 (Boot or Logon Autostart Execution), T1053 (Scheduled Task/Job), T1546 (Event Triggered Execution), T1098 (Account Manipulation), and T1136 (Create Account), among others. The value of the ATT&CK mapping for defenders is that it converts the conceptual map into a coverage matrix: for each technique, a team can ask whether they have a data source, a detection rule, and a tested alert. Gaps clustered around the environmental-hijacking and identity-based classes are the most common finding, because those artifacts live outside the traditional autostart enumeration paths that most commercial agents were built around.


For authorized red teams, the same map serves as a planning and deconfliction instrument. A well-scoped engagement specifies in advance which persistence families are in-bounds and — critically — documents every artifact planted for the cleanup phase, because a simulated adversary that leaves real persistence behind has crossed from emulation into actual harm. The discipline of writing down each planted artifact, its location, and its removal step also produces the most useful artifact of all for the blue team: a ground-truth dataset of what real persistence looks like in the organization's actual environment, against which detections can be validated rather than theorized.


The final conceptual point is economic. Persistence mechanisms trade stealth against resilience: a redundant array of crude autostarts is nearly guaranteed to survive but lights up every scanner, while a single subtle environment hijack may evade everything but dies if the user's dotfiles are rebuilt. Sophisticated adversaries therefore layer — one credential-based fallback, one event-triggered mechanism, one scheduler entry — so that partial cleanup fails silently. Defenders should mirror that assumption: eradication that removes one artifact and declares victory is the classic post-incident failure mode. The correct posture, after any confirmed compromise, is full reinstallation or verified restoration from known-good state plus a swept identity store, because the conceptual map tells us the attacker had far more places to hide than the one place they were found.



Educational analysis for authorized security professionals. Use only in controlled, authorized environments.






Source: OffensiveSec
Source Link: https://www.offsecblog.com/2026/11/the-anatomy-of-persistence-conceptual.html


Comments
new comment
Nobody has commented yet. Will you be the first?
 
Forum
Red Team (CNA)



Copyright 2012 through 2026 - National Cyber Warfare Foundation - All rights reserved worldwide.