Linux Privilege Escalation: Enumeration Cheatsheet
Copy-paste-ready enumeration commands covering every critical Linux privesc vector — OS, users, network, files, capabilities, and scheduled tasks. Built for Red Teamers, pentesters, and CTF players.
Methodology first. Enumerate fully before exploiting anything. Work top-to-bottom: OS → Users → Network → Files → Capabilities. One skipped category is one missed path to root.
OS Enumeration
::Kernel & Architecture
What to extract from uname -a output:
- ▹Kernel version — run through Linux Exploit Suggester and cross-check on Exploit-DB
- ▹Architecture — determines which precompiled exploit binaries will execute
Architecture mismatch kills payloads silently. A x86_64 exploit will not run on aarch64.
Always confirm uname -m before uploading any compiled binary.
::Kernel Compile Info
Example output:
- ▹
6.8.0-41-generic→ kernel version - ▹
x86_64-linux-gnu-gcc-13→ compiler — match this version when compiling exploits locally to avoid ABI mismatches - ▹
buildd@lcy02-amd64-077→ build machine (useful for fingerprinting cloud images)
::OS Release
::Storage & Filesystems
/etc/fstab - Unmounted partitions — potentially weaker permissions or cached sensitive
data - NFS mounts with no_root_squash — local root on the attacker machine becomes root on
the NFS share - CIFS/SMB mounts with inline credentials — username= and password= options
are plaintext in the file
::Running Processes
ps aux columns to focus on:
- ▹USER — processes running as
rootthat reference writable scripts are your target - ▹COMMAND — look for web servers, database processes, custom application scripts
Tree view (ps axjf) exposes parent-child relationships — spot scripts spawned by root
daemons that might be replaceable or injectable.
::Scheduled Tasks
crontab field reference:
- ▹Field order:
minute hour day-of-month month day-of-week user command - ▹
30 2 * * 1→ 02:30 every Monday asroot - ▹
*/5 * * * *→ every 5 minutes asroot - ▹Sixth field is your target —
rootmeans any script it calls runs with full privileges
Cron/timer privesc trigger: If a root-owned scheduled task calls a script at a world-writable
path (/tmp/, /home/user/script.sh), overwrite that script with a payload. Check permissions
on every path referenced in crontab entries and timer unit files — not just the script itself,
but every directory in the path.
::Installed Packages
Cross-reference discovered versions with searchsploit <package> <version> or exploit-db.com.
User Enumeration
::Current User Context
Example output:
High-value group memberships — flag and act on immediately:
| Group | Escalation Vector |
|---|---|
sudo / wheel | Check sudo -l immediately |
docker | docker run -v /:/mnt -it alpine chroot /mnt sh |
disk | Raw block device read via debugfs /dev/sda1 |
lxd / lxc | Container image import → host root escape |
adm | Read /var/log/auth.log — credentials in logs |
shadow | Read /etc/shadow password hashes |
::Environment Variables
Hunt for:
- ▹
PATH— writable directory earlier in PATH → hijack a binary called by root - ▹
LD_PRELOAD/LD_LIBRARY_PATH— if preserved acrosssudo→ shared library injection - ▹Credential patterns —
*_KEY,*_TOKEN,*_SECRET,*_PASSWORD,DATABASE_URL,AWS_*
If sudo -l output shows env_keep+=LD_PRELOAD, you have a trivial root escalation. Compile
a malicious .so that calls setuid(0) + execvp("/bin/bash") in its constructor, then run any
sudo-allowed command with it set.
::Command History
::Sudo Permissions
Example output:
Every NOPASSWD entry is a potential root shell. Cross-reference every allowed binary at
GTFOBins → filter by sudo. Common vectors that always have
entries: nmap, vim, find, python, perl, ruby, awk, less, more, tee, cp,
tar, bash, curl, wget, env.
::/etc/passwd
Field format: username : password : UID : GID : comment : home_dir : shell
- ▹UID
0— root-equivalent regardless of username; flag immediately - ▹
xin password field — hash stored in/etc/shadow - ▹Hash directly in the passwd field (legacy systems) —
/etc/passwdis world-readable, crack it
::/etc/shadow
If /etc/shadow is readable, extract all hashes and crack offline. Hash format identification:
| Prefix | Algorithm | Hashcat Mode |
|---|---|---|
$6$ | SHA-512crypt | -m 1800 |
$5$ | SHA-256crypt | -m 7400 |
$2y$ / $2b$ | bcrypt | -m 3200 |
$1$ | MD5crypt | -m 500 |
::SSH Keys
Check permissions on every hit. A private key owned by root but with loose permissions (644 or 640) is a direct path:
If the key is passphrase-protected, crack it:
::User Capabilities
Network Enumeration
::Interfaces & Routes
Interface signatures: - docker0 → Docker running locally; potential container escape or
Docker socket abuse - tun0 / wg0 → VPN active - virbr0 → KVM/libvirt hypervisor - Multiple
non-loopback interfaces → active pivot point; map all subnets with ip route
::Active Connections & Listening Ports
Services bound to 127.0.0.1 are invisible externally but fully accessible on the box. Internal-only ports are high-value targets — databases, admin panels, internal APIs, CI/CD agents. Reach them via local port forwarding from your attack box:
File System Enumeration
::SUID / SGID Binaries
Every result is a potential root shell. Feed each binary directly to
GTFOBins and filter by suid. Non-standard or custom SUID binaries
not listed in GTFOBins warrant manual reverse engineering with ltrace, strace, or ghidra.
::Writable Directories & Files
Writable files outside /tmp and your own home directory are anomalies. Scripts called by
root-owned cron jobs or systemd services at writable paths are direct escalation paths. Overwrite
them with a payload before the next trigger fires.
::Sensitive File Discovery
::Dev Tools & Scripting Languages
Available interpreters determine your payload options without transferring extra binaries.
python3 + gcc on target = compile and execute arbitrary C on the box. perl + python =
multiple GTFOBins shell escape routes available.
::Linux Capabilities
Example output:
Capabilities are the most overlooked privesc vector. They grant individual kernel privileges to binaries without the SUID bit — completely invisible to basic ls -la audits and missed by many automated tools.
| Capability | Impact |
|---|---|
cap_setuid | setuid(0) → instant root shell |
cap_setgid | setgid(0) → root group escalation |
cap_dac_read_search | Bypass all file read permissions → dump /etc/shadow, read any file |
cap_sys_admin | Near-omnipotent: mount, ptrace, namespace ops, CAP_SYS_ADMIN exploits |
cap_net_raw | Capture raw network traffic |
cap_net_bind_service | Bind to privileged ports < 1024 |
The +ep suffix = Effective + Permitted — capability is active on execution. Cross-reference all hits at GTFOBins → Capabilities.
Quick Reference
| Command | Purpose |
|---|---|
uname -a | Full kernel version string |
uname -m | CPU architecture (x86_64 / aarch64) |
cat /proc/version | Kernel compile info + compiler version |
cat /etc/issue && cat /etc/os-release | OS name and version |
lsblk | Block devices + mount points |
cat /etc/fstab | All filesystems incl. unmounted, NFS, CIFS |
ps aux | All running processes with owners |
cat /etc/crontab && cat /etc/cron.d/* | Root cron jobs |
systemctl list-timers --all | systemd scheduled timers |
dpkg -l | Installed packages + versions |
id | Current UID, GID, group memberships |
sudo -l | Allowed sudo commands |
env | Environment variables — PATH, LD_PRELOAD, secrets |
cat ~/.bash_history | Command history |
cat /etc/passwd | grep /bin/bash | Real interactive users |
ls -la /etc/shadow | Shadow file permissions |
find / -name id_rsa 2>/dev/null | Private SSH keys |
find / -perm -u=s -type f 2>/dev/null | SUID binaries |
find / -perm -g=s -type f 2>/dev/null | SGID binaries |
find / -type d -perm -0002 2>/dev/null | World-writable directories |
find / -perm -0002 -type f 2>/dev/null | grep -v proc | World-writable files |
find / -user root -writable -type f 2>/dev/null | grep -v proc | Root-owned, user-writable files |
find / -name ".env" -type f 2>/dev/null | .env credential files |
find / -name "*.bak" -type f 2>/dev/null | Backup files |
find / -mtime -5 -type f 2>/dev/null | grep -v proc | Recently modified files |
getcap -r / 2>/dev/null | Linux capabilities on binaries |
ip addr && ip route | Network interfaces and routing table |
ss -tpln | TCP listening ports + process names |
Linux Privilege Escalation: Basics & Exploitation
Kill chains for sudo abuse, SUID/capabilities, PATH hijacking, cron exploitation, NFS no_root_squash, and runtime process hunting with pspy. Built for Red Teamers and CTF players who skip the theory.
Shell Upgrade Cheatsheet
Complete guide to upgrading dumb shells to fully interactive TTYs during penetration testing
Active Directory Enumeration & Attacks Cheatsheet
A comprehensive reference for AD enumeration and attack paths — covering external/internal recon, password spraying, network poisoning, credentialed enumeration, ACL abuse, Kerberos attacks, delegation abuse, lateral movement, domain dominance, GPO exploitation, ADCS misconfigurations, cross-forest trust abuse, and advanced exploits. Designed for Red Team engagements.
