Windows Scheduled Task Abuse for Privilege Escalation
Windows Task Scheduler runs tasks as SYSTEM, Administrator, or other privileged accounts on a schedule. If a task runs a script or binary you can write to, or if the task definition itself is modifiable, you can execute arbitrary code as the task's user. This is the Windows equivalent of cron job abuse on Linux.
Prerequisites Check
List all scheduled tasks with full details:
Shorter overview:
Step 1 — Find High-Value Tasks
Focus on tasks that:
Run as
SYSTEM,Administrator, or a privileged userExecute a script or binary in a non-system directory
Have a schedule that fires automatically
Step 2 — Find Writable Task Scripts or Binaries
Once you identify a high-value task, check the permissions of what it executes:
Look for (W), (M), or (F) for your user.
Using PowerUp:
Step 3 — Modify the Writable Script or Binary
If the task runs a PowerShell script:
Or replace entirely with a reverse shell:
If the task runs a batch file:
If the task runs an EXE in a writable location:
Step 4 — Trigger the Task
Wait for the scheduled time, or trigger manually if you have permission:
If you cannot run it manually, check the schedule:
Step 5 — Modify the Task Definition Directly (If Writable)
Task XML definitions are stored in:
Check if any task file is writable:
If writable, read the XML, modify the <Command> or <Arguments> element, and save:
Creating a New Task (If Allowed)
If your user can create scheduled tasks, create one that runs as SYSTEM:
References
-
Task Scheduler Referencedocs.microsoft.com/en-us/windows/win32/taskschd/task-scheduler-reference (opens in new tab)
Microsoft Docs Task XML schema, principal settings, and action types.
-
Get-ModifiableScheduledTaskFile Automated scheduled task write permission detection.
Was this helpful?
Your feedback helps improve this page.