Course contentsShow
← Security
Lesson 2118 of 3,05242. Penetration Testing and Red TeamingFree lesson

Maintaining Access and Persistence Mechanisms

Techniques for maintaining long-term access including backdoors, scheduled tasks, registry keys, and service modifications.

Maintaining Access and Persistence Mechanisms

What you'll learn: How attackers establish long-term footholds in compromised systems to survive reboots, credential changes, and security sweeps.

After successfully exploiting a target (as covered in earlier exploitation lessons), an attacker's access is often fragile—a simple system reboot or user logout can break the connection. Persistence mechanisms solve this problem by ensuring access survives across system restarts and maintains a foothold even when initial entry points are closed.

Core Persistence Techniques

Think of persistence like hiding spare keys around a house you've broken into—you want multiple ways back in, even if the front door gets locked.

Backdoors are hidden entry points installed on compromised systems. These might be custom malware, web shells uploaded to servers, or modified legitimate binaries that accept special commands.

Scheduled tasks (Windows Task Scheduler, Linux cron jobs) can execute malicious scripts at regular intervals or system startup, automatically re-establishing connections to attacker infrastructure.

Registry modifications on Windows systems enable persistence through Run keys (HKLM\Software\Microsoft\Windows\CurrentVersion\Run), which execute programs at user login, or more subtle entries like COM hijacking that trigger on specific system events.

Service modifications involve creating new Windows services or Linux systemd units that start automatically with the system, or modifying existing legitimate services to include malicious functionality—a technique called DLL injection or binary replacement.

The Defender's Challenge

Sophisticated attackers install multiple persistence mechanisms (called "living off the land" when using built-in OS features), making complete removal difficult. A defender might find one backdoor while three others remain hidden.

Key Takeaway: Persistence mechanisms transform temporary access into durable control by leveraging scheduled tasks, registry keys, services, and backdoors—understanding these techniques is essential for both offensive testing and defensive incident response.