Endpoint Persistence
Mechanisms
Learn how attackers maintain long-term access to compromised systems and how defenders can detect and prevent these techniques.
What Is Persistence?
In cybersecurity, persistence refers to any technique an attacker uses to maintain access to a compromised system across reboots, logoffs, or credential changes. Without persistence, an attacker would lose their foothold every time the machine restarts.
Why Persistence Matters
Where Persistence Fits in the Attack Lifecycle
The Core Principle of Persistence
Categories of Persistence
User-Level vs System-Level Persistence
| User-Level | System-Level | |
|---|---|---|
| Privileges Needed | Standard user | Admin / SYSTEM |
| Scope | Active only when that user logs in | Active for all users, starts at boot |
| Common Locations | HKCU\...\Run, user Startup folder | HKLM\...\Run, services, boot records |
| Detection Difficulty | Easier: user-space tools can see it | Harder: may need kernel-level inspection |
| Stealth | Lower: visible in user profile | Higher: can masquerade as OS components |
Registry Run Keys Deep Dive
Scheduled Tasks as Persistence
Attackers create a scheduled task that triggers on system startup, user logon, or at a recurring time interval. The task launches the malicious payload without any user interaction.
Services and Daemons
On Windows, attackers can create a new Windows Service or modify an existing one to point to their malware. On Linux, they can create a systemd unit file or modify init scripts. Services run as SYSTEM or root: the highest privilege level.
Startup Folders and DLL Hijacking
How to Investigate Persistence
Example: Suspicious Registry Entry
Example: Malicious Scheduled Task
Example: DLL Hijacking in Action
Common Mistakes in Detection
Summary of Persistence Mechanisms
| Mechanism | Privilege | Stealth | Detection Tool |
|---|---|---|---|
| Registry Run Keys | User or Admin | Low | Autoruns, reg query |
| Scheduled Tasks | User or Admin | Medium | schtasks, Task Scheduler |
| Services | Admin / SYSTEM | Medium-High | sc query, services.msc |
| Startup Folder | User | Very Low | File explorer, dir |
| DLL Hijacking | Varies | High | Process Monitor, Sysmon |
| Bootkit / Firmware | Admin / Physical | Very High | UEFI scan, chipsec |
Question 1 of 5
An analyst discovers a new entry in HKCU\Software\Microsoft\Windows\CurrentVersion\Run pointing to C:\Users\Public\svchost.exe. What makes this suspicious?
Question 2 of 5
Which persistence mechanism runs with the highest privilege level by default?
Question 3 of 5
In a DLL hijacking attack, where does the attacker place the malicious DLL?
Question 4 of 5
A scheduled task named "SystemHealthMonitor" was created at 2:47 AM and runs powershell.exe -enc [encoded string] at startup. Which combination of indicators is most concerning?
Question 5 of 5
Which of the following is the most effective first step when investigating potential persistence on a compromised Windows endpoint?