Skip to content
Pwnversity
WIN-PRIVESCintermediate · 7 min · upd. 2026-11

Windows Privilege Escalation

T1068T1548T1574.011T1134.001

Escalating from an unprivileged user to SYSTEM (or local Administrator) is the bridge between “I have a shell” and “I control the machine.” On Windows, a kernel exploit is rarely needed: the norm is abusing weak configurations —service permissions, poorly defined paths, token privileges, scheduled tasks— that administration itself left exploitable. The kernel is the last resort, not the first. The broken invariant: the system trusts paths, permissions and privileges that someone misconfigured, and the attacker uses its own rules against it.

flowchart TD
    W["whoami /priv"] -->|SeImpersonate| P["Potato → SYSTEM"]
    W -->|SeBackup/SeDebug| C["dump SAM/LSASS"]
    S["services/tasks"] -->|weak binPath or DLL| SYS["execution as SYSTEM"]
    A["AlwaysInstallElevated"] -->|.msi| SYS
    K["kernel (last resort)"] -.-> SYS
  • Who attacks: someone with a low-privilege shell on the host (a service account, a normal user) who wants to reach SYSTEM or local Administrator.
  • What it breaks: misplaced trust in configuration. A service running as SYSTEM but whose binary is modifiable by a normal user is, in effect, SYSTEM for that user.
  • What it gains: full host control: SAM/LSASS dumping, persistence, disabling defenses and —on a domain host— jumping to domain credentials.
  • Why it’s almost never kernel: kernel exploits are noisy and can take down the host; escalation is almost always finding the weak-configuration link.
  1. Token privileges (whoami /priv): the most reliable quick win.
  2. Misconfigured services: reconfigurable binPath, unquoted paths, weak permissions, DLL hijacking.
  3. Scheduled tasks and autoruns that run elevated invoking something modifiable.
  4. AlwaysInstallElevated: any .msi installs as SYSTEM.
  5. Credentials and secrets reusable toward an admin account.
  6. Kernel exploits: last resort.

If the user (typical in IIS/MSSQL service accounts) has SeImpersonatePrivilege, the Potato family forces a privileged service to authenticate to you and impersonates its SYSTEM token (full detail in tokens):

PrintSpoofer.exe -i -c cmd # SeImpersonate -> SYSTEM
GodPotato.exe -cmd "cmd /c whoami" # Win8-11 / Server 2012-2022

Other direct privileges: SeBackup (read SAM/NTDS.dit), SeRestore/SeTakeOwnership (take over files/services), SeDebug (dump LSASS), SeLoadDriver (BYOVD).

accesschk.exe -uwcqv "Users" * # Sysinternals: writable permissions
sc qc <service> # view binPath and account
sc config <service> binPath= "C:\tmp\evil.exe" # if you can reconfigure
sc stop <service> & sc start <service>
  • Weak service permissions: reconfigure binPath → execution as the service’s account.
  • Unquoted service path: a path with spaces without quotes (C:\Program Files\...) → drop C:\Program.exe.
  • Weak binary/folder perms: replace the service’s executable.
  • DLL hijacking: the service loads a DLL from a writable path.
schtasks /query /fo LIST /v
reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"

Tasks that run as SYSTEM invoking modifiable scripts/binaries; writable startup entries (Run keys, Startup folder).

If both keys are 1, any .msi installs as SYSTEM:

reg query HKCU\Software\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
reg query HKLM\Software\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
msiexec /quiet /qn /i evil.msi

GPP cpassword, unattend.xml, autologon in the registry, cmdkey, DPAPI, in-memory credentials → reuse toward an admin account (see credential dumping).

Map systeminfo + hotfixes with wesng/Watson → PrintNightmare, CVE-2021-1732, etc. Noisy and can take down the host; use it when everything else fails.

  1. whoami /priv: SeImpersonate/Backup/Restore/Debug/LoadDriver? → to tokens.
  2. accesschk/winPEAS over services: reconfigurable binPath, unquoted path, hijackable DLL?
  3. Tasks and Run keys modifiable that run elevated.
  4. AlwaysInstallElevated in HKCU and HKLM.
  5. Credentials reusable toward admin.
  6. Only if nothing works: kernel, mapping build+hotfixes.
  • winPEAS / PowerUp (Invoke-AllChecks) / Seatbelt / SharpUp: automatic detection of all vectors.
  • accesschk.exe (Sysinternals): service, file and registry permissions.
  • PrintSpoofer / GodPotato / SigmaPotato: SeImpersonate exploitation.
  • wesng / Watson: mapping patches to kernel exploits.

From user to local SYSTEM: SAM/LSASS dumping, persistence, disabling defenses and —on a domain host— jumping to domain credentials and pivoting.

  • Service reconfiguration (sc config, events 7040/4697), creation of new services (7045).
  • Potato/PrintSpoofer execution (anomalous named pipes, spoolsv/rpcss → SYSTEM shell).
  • msiexec launching installers from user paths; accesschk/winPEAS.
  • Scheduled task creation/modification (4698/4702).
  • Sysmon (1/7/11/13), service and task creation auditing, Script Block Logging.
  • LSASS access alerts (Sysmon event 10 toward lsass.exe).
  • Correct permissions on services, binaries and folders; quotes on all service paths.
  • Disable AlwaysInstallElevated; review Run keys and tasks.
  • Remove dangerous privileges from service accounts; use gMSA.
  • LAPS for the local admin; patch up to date (closes kernel exploits).
  • EDR with LSASS-access blocking and, against BYOVD, Microsoft’s vulnerable driver blocklist (default on Windows 11 2022+) with HVCI.

Rebuild the host if it reached SYSTEM, rotate all local secrets and credentials of accounts that logged in, and close the specific vector (permission/service/task).

  • PrintNightmare (CVE-2021-34527 / CVE-2021-1675): RCE/LPE via the spooler, mass exploitation.
  • HiveNightmare/SeriousSAM (CVE-2021-36934): lax ACLs on SAM/SYSTEM allow reading hashes as a user.
  • CVE-2021-1732, CVE-2022-21882: win32k LPE used in real attacks.
  • The Potato family (SeImpersonate) is a standard TTP against IIS/MSSQL service accounts (MITRE T1134).
  • whoami /priv — SeImpersonate/Backup/Restore/Debug/LoadDriver?
  • Services with weak permissions or reconfigurable binPath (accesschk).
  • Unquoted service paths with a writable folder.
  • DLL hijacking in privileged services/apps.
  • Modifiable scheduled tasks and Run keys that run elevated.
  • AlwaysInstallElevated = 1 in HKCU and HKLM.
  • Credentials in configs/registry reusable toward admin.
  • Unpatched build mappable to a kernel exploit (only if everything else fails).