Last updated: April 29, 2026
Root escalation — getting from “regular user” to “root” or SYSTEM — is how most breaches turn catastrophic. A foothold becomes domain compromise via privilege escalation. This module covers the technique classes, the defences, and what a practitioner should be able to recognise on both the offensive and defensive sides.
The privesc landscape
Privilege escalation falls into five broad buckets:
- Kernel exploits — memory-corruption or logic bugs in the OS kernel grant root
- Misconfigurations — setuid binaries, writable sudoers, cron jobs running as root
- Weak credentials — reused passwords, password in memory, SSH key theft
- Service exploitation — privileged services with exploitable bugs (systemd, polkit, cron)
- Stored credentials — AWS keys on disk, tokens in env, credentials in shell history
Classic Linux privesc patterns
SUID binaries
Any binary with setuid root permission runs as root when executed by any user. Legitimate: passwd, sudo, ping. Dangerous: custom scripts, old packages.
# Find all SUID binaries
find / -perm -4000 -type f 2>/dev/null
# Many SUID binaries have GTFOBins entries — documented escalation
# e.g. find, vim, less can all pop shells if SUID
# See gtfobins.github.io
Sudo misconfigurations
Check what you can sudo:
sudo -l
# Common escalation patterns:
# (ALL) NOPASSWD: /usr/bin/vim — sudo vim → :!/bin/bash
# (ALL) NOPASSWD: /usr/bin/find — sudo find . -exec /bin/sh \;
# (ALL) NOPASSWD: ALL — trivial: sudo su -
Writable critical files
- /etc/passwd or /etc/shadow writable by user — add root entry, set password
- /etc/sudoers writable — add own NOPASSWD line
- /etc/cron.d/* writable — schedule root-executed script
- Service unit files writable — modify ExecStart to run malicious
Kernel exploits
Historical high-impact kernel CVEs:
- Dirty Pipe (CVE-2022-0847) — kernel 5.8 to 5.16; rewrite arbitrary read-only files
- Dirty CoW (CVE-2016-5195) — race condition in copy-on-write; overwrite read-only memory
- PwnKit (CVE-2021-4034) — polkit/pkexec; near-universal Linux LPE
- Stack Clash (CVE-2017-1000364) — glibc/kernel stack boundary smash
Run linpeas or LinEnum for automated privesc reconnaissance. Run kernel-checker type tools. Patch kernels promptly — most kernel CVEs have rapidly-developed public exploits.
Classic Windows privesc patterns
UAC bypasses
Bypassing UAC from medium-integrity user to high-integrity admin. Historical vectors include sdclt.exe, fodhelper.exe, registry abuse, DLL sideloading. Modern Windows has patched most individual bypasses but classes persist.
Unquoted service paths
# Service configured with:
C:\Program Files\Some Service\service.exe
# (missing quotes around the path)
# Windows tries paths in order:
# C:\Program.exe
# C:\Program Files\Some.exe
# C:\Program Files\Some Service\service.exe
# Attacker plants malicious C:\Program.exe → runs as SYSTEM on service start
Weak service / registry permissions
Services running as SYSTEM but writable by normal user = trivial escalation via modifying executable. Tools: PowerUp.ps1, SharpUp, WinPEAS.
Token impersonation
SeImpersonatePrivilege or SeAssignPrimaryTokenPrivilege allow impersonating any token. Service accounts (IIS, SQL Server) often have this. Exploits: RottenPotato, JuicyPotato, PrintSpoofer, PetitPotam chains.
Credential harvesting
- lsass memory dump → Mimikatz → recovered passwords/hashes
- SAM + SYSTEM registry hives → offline cracking
- GPP cpassword (legacy) → SYSVOL → decryptable via published AES key
- Browser-saved credentials → harvest DPAPI-protected credentials
Defences
Linux
- Patch kernel + key packages promptly (unattended-upgrades)
- Audit setuid binaries monthly; remove unneeded
- Tighten sudoers — no NOPASSWD for regular users; no wildcards in commands
- Mandatory Access Control (SELinux/AppArmor) in Enforcing
- auditd rules for privesc execve patterns
- Monitor /etc/passwd, /etc/shadow, /etc/sudoers, crontabs for unexpected writes
Windows
- Credential Guard + LSA Protection — defeats most credential-theft
- Protected Users group for privileged admins
- LAPS for unique local admin per machine
- Tiered admin — DA never logs in to user workstations
- Audit service permissions; ensure no user-writable executables or registry keys
- Disable unused services (especially print spooler — PrintNightmare vector)
- Fast patching — especially for polkit, Windows kernel, common services
Application-layer privesc
- Don’t run web apps as root / SYSTEM — separate service account, minimum privilege
- Don’t expose admin UIs on internet without MFA + IP allowlist
- Parameterise all database queries (SQLi can upload webshell → command execution → privesc)
- File-upload restrictions — content-type validation, path sanitization, no execute permission on upload dirs
Practitioner workflow (offensive)
After initial foothold, typical privesc sequence:
- Enumerate (linpeas/winpeas/LinEnum/PowerUp) — what are we running, what can we write, what’s mis-permissioned
- Check sudoers + SUID (Linux) / service ACLs + token privileges (Windows)
- Check kernel version against known exploit database
- Hunt for stored credentials (~/.bash_history, ~/.aws/credentials, config files, memory dumps, DPAPI blobs)
- Try credential-based lateral movement first; kernel exploits last (noisiest)
- Document every step for the report — even failed attempts
Practitioner workflow (defensive)
- Monthly audits — linpeas/winpeas against your own fleet
- Detection rules for privesc patterns — auditd rules, Sysmon/Event-ID alerts
- Attack simulation — purple-team exercises, Atomic Red Team, Caldera
- Remediate findings with owner + deadline; track over time
- Incorporate into patch management cadence
Quick reference summary
- Privesc = user → root / SYSTEM. Five buckets: kernel, misconfig, credentials, services, stored creds
- Linux classics: SUID binaries (GTFOBins), sudo misconfigs, writable sudoers, kernel CVEs (Dirty Pipe, PwnKit)
- Windows classics: unquoted service paths, weak service ACLs, token impersonation (Potato family), credential theft via LSASS
- Defences: patch promptly, Credential Guard / MAC enforcing, tiered admin, LAPS, audit SUID/services/sudoers
- Workflow: enumerate → check low-hanging fruit → kernel exploits last (noisy)
- Monthly privesc audit against own fleet using public tools
Module Quiz · 20 questions
Pass with 80%+ to mark this module complete. Unlimited retries. Each question shows an explanation.
Custom team training + practitioner advisory
Beyond the free academy — we run private workshops, vCISO advisory, and red-team exercises tailored to your stack. For Indian SMBs scaling past their first hire.