This article teaches Windows privilege escalation techniques used in penetration testing, covering four primary exploitation paths: WinPEAS automated enumeration, AlwaysInstallElevated registry exploitation, unquoted service paths, and SeImpersonatePrivilege token impersonation via GodPotato. The article demonstrates that persistent misconfigurations—not zero-days—enable most Windows privilege escalations, and shows how to identify, exploit, and remediate them systematically. These techniques are critical for penetration testers because they represent the gap between organizations that merely run Windows and those that run it securely.
- WinPEAS automates 300+ security checksWinPEAS performs over 300 simultaneous enumeration points in under 60 seconds, checking registry policies granting elevated installer rights, service executable paths and ACLs, system path file permissions, stored credentials, scheduled tasks running as SYSTEM, installed software versions against CVEs, token privileges, and network configuration. Color-coded output highlights red (high-confidence exploitable) and yellow (needs verification) findings, telling an attacker more than an hour of manual enumeration would. However, WinPEAS generates significant filesystem and registry activity that m
- AlwaysInstallElevated requires both registry keysAlwaysInstallElevated exploits a Group Policy setting that forces the Windows Installer service (running as NT AUTHORITYSYSTEM) to execute all MSI packages with elevated privileges. The critical requirement is that both HKLM and HKCU registry keys must be set to 0x1—HKLM alone is insufficient and will result in standard-privilege execution with no escalation. When both keys are present, an attacker generates a malicious MSI with msfvenom, transfers it to the target, and executes it via `msiexec /quiet /qn /i` to achieve SYSTEM access in under two minutes. This setting typically persists for y
- Unquoted paths require writable intermediate directoriesWhen a Windows service path contains spaces without quotes (e.g., `C:Program FilesMy Applicationbinapp.exe`), the Service Control Manager attempts execution at multiple intermediate paths: C:Program.exe, then C:Program FilesMy.exe, then the actual binary. Exploitation requires write access to one of those intermediate directories—typically C: and C:Program Files are restricted to administrators, but third-party application subdirectories sometimes have permissive ACLs. The attacker uses icacls to verify write access, places a payload at an injectable path with the correct filename, a
- Weak service permissions enable binary path hijackingWindows services have access control lists defining which users can configure them. SERVICE_ALL_ACCESS or SERVICE_CHANGE_CONFIG permissions granted to non-administrative groups allow direct binary path modification. The accesschk utility (from Microsoft Sysinternals) audits these permissions and reports granular service flags. An attacker with these permissions uses `sc config [service] binpath= "payload.exe"` to redirect the service to their malicious executable, then restarts the service to execute it with the service account's privileges (often SYSTEM). The entire exploitation requires four
- SeImpersonatePrivilege enables token impersonation exploitationSeImpersonatePrivilege is a Windows default on IIS application pools and service accounts, not a misconfiguration, because these processes need it to impersonate connecting users for resource access. GodPotato exploits this by coercing a privileged COM server to authenticate over an attacker-controlled named pipe, capturing the SYSTEM-level authentication token and impersonating it to spawn a new process. This makes every Windows IIS web application compromise include a built-in SYSTEM escalation path. A single command (`GodPotato.exe -cmd "whoami"`) confirms SYSTEM access in under ten seconds
- Manual enumeration reduces EDR detection riskA 10-command manual checklist (whoami, systeminfo, registry queries, wmic service enumeration, scheduled task queries, cmdkey list, tasklist, netstat, and icacls) performs the highest-yield privilege escalation checks while generating far less telemetry than a full WinPEAS scan. The commands check SeImpersonatePrivilege and AlwaysInstallElevated first as the fastest wins, then surface unquoted paths via wmic and stored credentials via cmdkey. Each command produces a fraction of the telemetry that WinPEAS generates, making this approach suitable for red team engagements where endpoint detection
- Post-exploitation verification and cleanup are professional requirementsAfter gaining SYSTEM access, verification requires three confirmation commands: `whoami` to show nt authoritysystem, `whoami /groups` to confirm BUILTINAdministrators membership, and potentially `systeminfo` to capture OS details for the report. Demonstrating impact includes showing access to restricted files like SAM registry hives. Professional cleanup removes all created artifacts—user accounts, uploaded tools, generated payloads—and restores any modified service binary paths to their original values. Leaving services broken or artifacts behind alerts defenders and may cause system instab
- Multiple escalation vectors indicate compounding security failuresReal targets often exhibit multiple simultaneous escalation vectors. Finding three viable paths (AlwaysInstallElevated, unquoted service paths, and SeImpersonatePrivilege on the same system) indicates compounding security hygiene failures worth documenting thoroughly in a penetration test report. An attacker needs only one working path, but the presence of multiple vectors demonstrates systemic configuration neglect—each misconfiguration represents a separate governance, patching, or deployment process failure. This layered evidence strengthens the business case for remediation in client commu
Bottom line: Windows privilege escalation relies overwhelmingly on persistent misconfigurations (AlwaysInstallElevated, unquoted service paths, weak ACLs, SeImpersonatePrivilege) enabled years ago for operational convenience and never disabled, not on zero-days—WinPEAS or a 10-command manual checklist exposes all of them in under a minute, making systematic vulnerability assessment and remediation the only effective defense. Every penetration tester must master both automated enumeration (WinPEAS) and manual
FREE
Part of the Free Ethical Hacking Course — 100 Days
🎯 What You’ll Master in Day 32
⏱️ 45 min read · 3 exercises · Authorised lab targets only
📋 Prerequisites — Complete Before Day 32
- Day 31: Linux Privilege Escalation — SUID, sudo, cron exploitation on Linux provides the conceptual framework for Windows escalation patterns
- Day 21: Metasploit Framework — msfvenom MSI payload generation is used in the AlwaysInstallElevated exploit chain
- Day 28: Lateral Movement Techniques — SYSTEM access feeds directly into lateral movement and domain escalation
📋 Windows Privilege Escalation 2026 — Table of Contents
- WinPEAS — Automated Enumeration in 30 Seconds
- AlwaysInstallElevated — Registry Key to SYSTEM
- Unquoted Service Path Exploitation
- Weak Service Permissions with accesschk
- SeImpersonatePrivilege — Token Impersonation with GodPotato
- Additional Vectors — Scheduled Tasks, Stored Credentials, DLL Hijacking
- Post-Escalation — Verification, Impact Demonstration, Cleanup
Day 31 covered Linux privilege escalation — SUID exploitation, sudo misconfigurations, writable cron jobs. Day 32 is the Windows equivalent. The philosophy is identical: default configurations, legacy software, and administrator convenience settings create persistent escalation paths that survive undetected for years. This is core curriculum in the 100-Day Ethical Hacking Course. Every professional penetration tester must be fluent in both Linux and Windows privilege escalation — most real-world environments are mixed, and your escalation methodology must be too.
WinPEAS — Automated Windows Privilege Escalation Enumeration
WinPEAS (Windows Privilege Escalation Awesome Script) is the first tool you run the moment you establish code execution on a Windows target. Before manually checking anything, before chasing hunches, run WinPEAS. It checks over 300 enumeration points simultaneously and produces colour-coded output that shows you exactly which misconfigurations are present. Red and yellow highlights are your action items. Everything else is context. A full WinPEAS run takes under sixty seconds on most systems and tells you more than an hour of manual enumeration would.
What WinPEAS actually checks spans the entire Windows security model: registry policies that grant elevated installer rights, service executable paths and their access control lists, file system permissions on directories in the system path, stored credentials in the Windows Credential Manager and browser profiles, scheduled tasks that run as SYSTEM with writable script files, installed software versions cross-referenced against a local CVE database, token privileges enabled on the current account, and network configuration revealing additional lateral movement paths. Each check maps to a known escalation technique. When WinPEAS highlights something in red, that technique is viable with high confidence. Yellow means the finding warrants manual verification before exploitation.
⏱️ 12 minutes · Paper or text editor — no tools required
For each, choose your first technique, explain why, and describe your fallback.
TARGET A:
AlwaysInstallElevated HKLM = 0x1
AlwaysInstallElevated HKCU = 0x0
SeImpersonatePrivilege: Disabled
Unquoted path: C:\Program Files\Corp Tool\tool.exe
You can write to: C:\Program Files\Corp Tool\
TARGET B:
AlwaysInstallElevated HKLM = 0x1, HKCU = 0x1
SeImpersonatePrivilege: Enabled
No unquoted paths found
Running as: iis apppool\webapp
TARGET C:
No AlwaysInstallElevated
No SeImpersonatePrivilege
No unquoted paths
WinPEAS highlights: cmdkey /list → stored credential: DOMAIN\admin
One scheduled task runs C:\scripts\backup.ps1 as SYSTEM
You can write to: C:\scripts\
📸 Post your decision tree for all three targets in your notes. Discuss which single technique you’d prioritise with only 10 minutes on a target.
AlwaysInstallElevated — Registry Misconfiguration to SYSTEM
AlwaysInstallElevated is the Windows privilege escalation misconfiguration I encounter most frequently in enterprise environments. The setting exists for a legitimate operational reason — enabling it in Group Policy allows helpdesk staff to push MSI packages to user machines without the user needing administrator rights for each installation. IT teams enable it to solve a software deployment problem, solve that problem, and never revisit the setting. Three years later a penetration tester runs WinPEAS and it lights up in red.
The mechanism is straightforward. When AlwaysInstallElevated is active — both the HKLM and HKCU registry keys set to 0x1 — the Windows Installer service (which runs as NT AUTHORITY\SYSTEM) executes all MSI packages with SYSTEM privileges regardless of who launched the installer. This means any user on the system can craft a malicious MSI and achieve arbitrary code execution as SYSTEM. Generating the malicious MSI takes one msfvenom command. Executing it takes one msiexec command. The entire exploitation chain from “I see AlwaysInstallElevated in WinPEAS” to “SYSTEM shell on Netcat listener” takes under two minutes.
The critical prerequisite that many beginners miss: both the HKLM and HKCU registry keys must be set to 0x1. HKLM alone is not sufficient. The Windows documentation is clear on this, and WinPEAS checks both explicitly. If you see only the HKLM key set, move on to a different vector. Spending time generating and executing a malicious MSI when only one key is set will result in a standard user-privilege MSI execution — no escalation, wasted time, and potential detection from the msiexec call.
Unquoted Service Path Exploitation
Unquoted service paths exploit a documented Windows path resolution behaviour. When a Windows service is configured with an executable path that contains spaces but no surrounding quotation marks — such as C:\Program Files\My Application\bin\app.exe — the Service Control Manager does not know where the path ends. Windows resolves the ambiguity by making multiple sequential attempts. It first tries to execute C:\Program.exe, then C:\Program Files\My.exe, then C:\Program Files\My Application\bin\app.exe. If a malicious executable exists at any of the earlier positions, Windows executes it with the service account’s privileges before ever reaching the legitimate binary.
The exploitability of an unquoted path depends entirely on whether you can write a file to one of those intermediate positions. Writing to C:\ typically requires administrative rights. Writing to C:\Program Files\ is usually restricted to administrators. But writing to a specific third-party application’s subdirectory — C:\Program Files\MyApp\ — is sometimes permitted due to the application vendor setting permissive ACLs during installation. The icacls command lets you verify write access at each intermediate directory. Find one you can write to, place your payload there with the correct filename, and wait for the service to restart.
Weak Service Permissions — Hijacking Service Binary Paths
Every Windows service has an access control list defining which users and groups can query, start, stop, and configure the service. The most dangerous permission is SERVICE_CHANGE_CONFIG or SERVICE_ALL_ACCESS granted to a non-administrative group. With these permissions, a low-privilege user can directly modify the service’s executable path — redirecting it to run any file they specify. The modification takes effect on the next service start, at which point the service account (typically SYSTEM or LocalSystem) executes the attacker’s payload.
The accesschk utility from Microsoft Sysinternals is the standard tool for auditing service ACLs. It reports exactly which users and groups have which permissions on each service, including the granular Windows service permission flags. WinPEAS also checks this automatically and flags services where the current user’s context has modification rights. The exploitation steps are then identical regardless of discovery method: use sc config to point the service binary path at your payload, restart the service, collect the SYSTEM shell.
sc config VulnService binpath= "C:\Program Files\VulnService\vuln.exe". Leaving services broken is a red flag that will alert defenders and may cause system instability. Document the original path before modifying it.SeImpersonatePrivilege — Token Impersonation with GodPotato
SeImpersonatePrivilege is the privilege escalation vector I rely on most reliably in web application penetration tests on Windows. Here is why: when you gain code execution through a web vulnerability — a deserialization exploit, a file upload to webshell, a remote code execution CVE in a web framework — your shell runs as the IIS application pool identity or a dedicated service account. These accounts have SeImpersonatePrivilege enabled by Windows design. It is not a misconfiguration. It is the default. And it means that every Windows web application compromise comes with a built-in privilege escalation path.
The technical mechanism behind token impersonation exploits involves Windows COM infrastructure. GodPotato coerces a privileged COM server to authenticate over a named pipe controlled by the attacker. When the SYSTEM-level process connects, GodPotato captures its authentication token. Using SeImpersonatePrivilege, GodPotato then impersonates that token and spawns a new process — your payload — running as NT AUTHORITY\SYSTEM. The entire chain is automated in a single GodPotato command. It supports all Windows versions from Server 2012 to Server 2022, making it the most universally applicable token impersonation tool currently available.
Additional Windows Privilege Escalation Vectors
The four techniques above cover the vast majority of Windows privilege escalation findings in real assessments. WinPEAS checks dozens more, and several are worth knowing for specific environments. Stored credentials in the Windows Credential Manager are accessible via cmdkey /list — if an admin account credential is stored, runas /savecred lets you spawn a shell as that user without knowing the password. Scheduled tasks running as SYSTEM with writable script files allow command injection into the task’s script, achieving SYSTEM execution on the next scheduled run time. DLL hijacking works when a privileged process loads DLLs from directories where you have write access — placing a malicious DLL with the right name in the right location causes the privileged process to load and execute your code.
Kernel exploits deserve a specific note. When the Windows kernel version is outdated and a local privilege escalation CVE applies — PrintNightmare (CVE-2021-34527), HiveNightmare (CVE-2021-36934), or others — the escalation path may be more direct. Tools like Windows Exploit Suggester cross-reference the target’s missing patches against a CVE database and surface applicable kernel exploits. However, kernel exploits carry a risk of system instability and blue screens, and should only be used when authorised and when other escalation paths have been exhausted or verified as non-viable.
Post-Escalation — Verification, Impact, and Cleanup
Gaining SYSTEM access is the technical milestone. Proving it definitively and documenting it professionally is what produces a valuable penetration test report. The verification commands are fast. The discipline of capturing clean screenshots at each escalation step — before and after — is what separates a report that drives remediation from one that gets filed away. Every command in the chain, every output showing the privilege transition, every piece of evidence that the escalation was complete and reproducible belongs in the report appendix.
⏱️ 30 minutes · Free TryHackMe account — tryhackme.com
Start the dedicated room — it covers multiple techniques with a guided VM.
Step 2: AlwaysInstallElevated task:
– Connect to the machine via VPN or browser AttackBox
– Verify both registry keys are 0x1
– Generate MSI payload with msfvenom on your Kali
– Transfer and execute via msiexec /quiet /qn /i
– Capture the flag that appears in the SYSTEM shell
Step 3: Service exploitation task:
– Run accesschk against the target services
– Identify the service with weak permissions
– Use sc config to redirect the binary path
– Restart the service and collect the flag
Step 4: For each technique that works, write 3 sentences:
1. What misconfiguration made this possible
2. What single command triggered the escalation
3. How the client should remediate it
This is the format for your pentest report findings section.
📸 Screenshot all flags collected and your 3-sentence remediation notes. Post in your notes. with.
⏱️ 20 minutes · Kali + Windows lab VM or authorised TryHackMe/HTB machine
📸 Run all 10 commands and screenshot the outputs. Post in your notes. with any interesting findings.
🧠 QUICK CHECK — Day 32 Windows Privilege Escalation
📋 Commands Used Today — Day 32 Windows Privilege Escalation Reference
🏆 Mark Day 32 Complete — Windows Privilege Escalation 2026
Four core Windows escalation techniques mastered. Day 33 covers AV evasion basics — delivering payloads past Windows Defender and endpoint detection, which is what makes these techniques usable in environments where standard msfvenom outputs are immediately flagged and quarantined.
❓ Frequently Asked Questions — Windows Privilege Escalation 2026
What is Windows privilege escalation in penetration testing?
What is AlwaysInstallElevated and why does it enable SYSTEM access?
What is an unquoted service path and when is it exploitable?
What is SeImpersonatePrivilege and why is it found on IIS?
What does WinPEAS check for during Windows privilege escalation enumeration?
What comes before and after Day 32?
Day 31: Linux Privilege Escalation 2026
Day 33: AV Evasion Basics 2026
📚 Further Reading
- Day 31: Linux Privilege Escalation 2026 — The Linux equivalent: SUID binaries, sudo misconfigurations, writable cron jobs — essential context for understanding privilege escalation methodology across both operating systems.
- Day 28: Lateral Movement Techniques — Once you have SYSTEM, lateral movement is the next phase — pass-the-hash, BloodHound attack paths, and domain escalation all start from a SYSTEM-level foothold.
- Privilege Escalation Hub — Complete taxonomy of escalation vectors across Windows and Linux — course articles, cheat sheets, and tool references for the full privilege escalation domain.
- GodPotato — GitHub Repository — Official GodPotato source code, release binaries for all .NET versions, and technical documentation of the COM coercion mechanism used for token impersonation.
- WinPEAS / PEASS-ng — GitHub Repository — Official WinPEAS repository with latest release binaries, full documentation of all checks performed, and the LinPEAS Linux equivalent for cross-platform coverage.

