Practice library / Active Directory and Windows attacks
Lab · Medium · 2 hoursFree account
Windows Privilege Escalation
Weak services, unquoted paths, AlwaysInstallElevated, SeBackupPrivilege, and stored credentials — all the way to SYSTEM.
On this page 12 sections
- ·Prerequisites
- ·Lab setup
- 1Build the lab account and check your starting privileges
- 2Escalate through a misconfigured service
- Locked: Escalate through an unquoted service path
- Locked: Escalate through AlwaysInstallElevated
- Locked: Use SeBackupPrivilege to read a protected file
- Locked: Hunt for stored credentials
- Locked: Confirm your findings with automated enumeration
- Locked: Check
- Locked: Clean up
- Locked: Next lab
A Windows privilege escalation turns a standard user shell into a SYSTEM shell on the same host. Four root causes — a weak service permission, an unquoted service path, the AlwaysInstallElevated installer policy, and stored credentials from imaging or scheduled tasks — remain the top findings in modern internal penetration tests. Set up each misconfiguration yourself, exploit it as a limited account, then map the technique to the event ID that records it.
Lab Objectives
- Enumerate services, token privileges and registry policy on a Windows host
- Escalate to SYSTEM through a weak service permission, an unquoted service path, and the AlwaysInstallElevated policy
- Use SeBackupPrivilege to read a file your account cannot normally open
- Find credentials left behind in files, the registry and scheduled tasks
- Map each technique to the event ID or log entry that reveals it
Prerequisites
Complete these items first:
- Windows Command Line & PowerShell. You must know users, groups, services and basic PowerShell syntax.
- Privilege Escalation — Linux & Windows. This lab practises the Windows half of that workbook.
Linux Privilege Escalation is the companion lab for the other operating system. Do it before or after this one.
Lab setup
You need one Windows virtual machine that you own, with a local administrator account for setup and a standard user account you create during Step 1.
| Item | Requirement |
|---|---|
| Lab host | A Windows 10, Windows 11, Windows Server 2019 or Windows Server 2022 virtual machine that you own. A standalone machine works. If your lab already joins hosts to an isolated AD lab domain such as CORP.LOCAL, this lab works the same on a domain member — none of the techniques here need domain rights. |
| Account | A local administrator account, used only to build the vulnerable conditions. Open Windows PowerShell or Command Prompt with Run as administrator. |
| Shell | Windows PowerShell 5.1 or cmd.exe. Both are built in. |
| Snapshot | Take a snapshot of the lab host before Step 1. You can then undo every change. |
Authorized lab only. Run every command in this lab on a VM you own or were given for this course, never on a production machine, a work computer or a system you do not control. This lab deliberately misconfigures services and registry policy so that you can learn to find and fix the same misconfiguration on a real host. Use 10.0.0.0/8 or 192.168.0.0/16 addresses and lab-only passwords, never real credentials.
Step 1: Build the lab account and check your starting privileges
Create the standard user and open a session as that user
As the administrator, create a standard local account. Open a new shell that runs as that account. Then check what the account can do before you change anything.
net user labuser 'Lab-Pass-26!x' /add
mkdir C:\LabEvidence
icacls C:\LabEvidence /grant "labuser:(OI)(CI)M"Open a second shell that runs as labuser. Keep the administrator shell open too — later steps switch between them.
runas /user:%COMPUTERNAME%\labuser cmdWindows prompts for the password in the new window. From here on, run the commands marked (labuser) in that window, and the commands marked (administrator) in the first window.
whoami /priv
whoami /groupsPRIVILEGES INFORMATION
----------------------
Privilege Name Description State
============================== ===================================== ========
SeShutdownPrivilege Shut down the system Disabled
SeChangeNotifyPrivilege Bypass traverse checking Enabled
SeUndockPrivilege Remove computer from docking station Disabled
SeIncreaseWorkingSetPrivilege Increase a process working set Disabled
SeTimeZonePrivilege Change the time zone DisabledA standard account holds only a short, low-risk privilege list, and most entries show Disabled. Compare this list after each step below. A new privilege in this list, or one that changes from Disabled to Enabled, is a sign of progress — or, on a real host, a sign of attack.
Why this matters. Every privilege escalation in this lab moves labuser from this short list to a full SYSTEM token. Defenders read the same whoami /priv output, or the equivalent token fields in an EDR process event, to judge how dangerous a given shell already is.
Step 2: Escalate through a misconfigured service
Create a service, give it a weak permission, then abuse it
As the administrator, create a service and grant labuser full control over the service object. As labuser, find that permission, point the service at a command of your choice, then start it.
Windows stores each service's permissions as a security descriptor, separate from the file permissions on its binary. A service's own permissions can be set too loosely by an installer, a script or an administrator — most often by granting a broad group more rights than it needs.
sc.exe create VulnSvc binPath= "C:\Windows\System32\svchost.exe" start= demand
sc.exe sdshow VulnSvc
sc.exe sdset VulnSvc "D:(A;;GA;;;AU)"D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)The exact letters vary by Windows build, but the account tokens at the end of each clause do not: SY is LocalSystem and BA is the Built-in Administrators group. Only those two can reconfigure the service by default. The sdset command above replaces the whole descriptor with one clause, (A;;GA;;;AU): Generic All (full control) for AU, Authenticated Users. That now includes labuser.
sc.exe sdshow VulnSvc
sc.exe qc VulnSvc
sc.exe config VulnSvc binPath= "C:\Windows\System32\cmd.exe /c whoami > C:\LabEvidence\proof-service.txt"
sc.exe start VulnSvcsdshow now returns D:(A;;GA;;;AU), which a standard user can read. qc shows the current binary path and the account the service runs as. config points the service at a new binary of your choice — here, a command that writes the current identity to a file. The service account was already LocalSystem before you touched it; you only changed what it runs.
[SC] StartService FAILED 1053:
The service did not respond to the start or control request in a timely fashion.cmd.exe is not a real service and never reports back to the Service Control Manager, so SCM gives up after its timeout and shows error 1053. By then, cmd.exe already ran and exited. Check the proof file, not the error.
type C:\LabEvidence\proof-service.txtnt authority\systemWhy this matters. A standard user just ran a command as SYSTEM, because the service's own permissions, not its file permissions, were the weak point. What a defender sees: sc.exe create and sc.exe sdset each raise System event 7045 only for a new service install, not for a permission change — a defender hunting this class of misconfiguration audits sc.exe sdshow or Get-Service | Get-Acl on build images, not just event logs. The sc.exe config step and the resulting cmd.exe process are the loud part: event 4688 (process creation, if enabled) shows cmd.exe with parent services.exe, which is never normal — any EDR rule worth having alerts on a child process of services.exe that is not a known service binary.
Sign in to continue
8 more sections are for signed-in members. It is free: sign in with Google.