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

Scheduled Tasks and Startup Persistence Exploitation

Abusing misconfigured scheduled tasks, startup programs, and auto-run registry keys that execute with elevated privileges for privilege escalation.

Scheduled Tasks and Startup Persistence Exploitation

What you'll learn: How attackers abuse misconfigured scheduled tasks, startup programs, and auto-run registry keys that execute with elevated privileges to escalate privileges and maintain persistence.

The Core Idea

Windows systems often run tasks automatically—scheduled jobs that execute at specific times, programs that launch at startup, or scripts triggered by system events. If these mechanisms are misconfigured (weak file permissions, modifiable task definitions, or writable registry keys), an attacker with limited privileges can hijack them to execute malicious code with elevated privileges.

Think of it like discovering that your office's automated security system runs a script every morning as an administrator—but the script file is stored in a folder where anyone can edit it. You could modify that script, and tomorrow morning, your changes run with admin rights.

Common Attack Vectors

Scheduled Tasks: Windows Task Scheduler runs jobs under specific user accounts (sometimes SYSTEM). If a low-privilege user can modify the task definition or the executable it runs, they inherit those elevated privileges when the task triggers.

Startup Folders: Programs in startup directories (C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp) execute when users log in. If these folders have weak permissions, attackers can plant executables that run automatically.

Registry Auto-Run Keys: Keys like HKLM\Software\Microsoft\Windows\CurrentVersion\Run specify programs to launch at startup. If these registry keys or the binaries they reference are writable by unprivileged users, attackers can hijack execution flow.

Why This Works

The vulnerability stems from broken access control—powerful operations configured to run automatically, but the configurations or binaries themselves aren't properly protected. When the legitimate high-privilege process executes the attacker's modified code, privilege escalation occurs.

Key Takeaway: Scheduled tasks, startup programs, and auto-run registry entries that execute with elevated privileges become privilege escalation vectors when their configurations or associated files have weak permissions—always audit what runs automatically and who can modify it.