Linux Enumeration
After getting a shell on a Linux host (usually low-privilege), the first job is understanding where you are before trying to escalate: who you are, what permissions you hold, what runs, what’s misconfigured, and what credentials are lying around. Orderly enumeration almost always reveals the escalation vector; firing exploits blindly is noisy and unnecessary. This card is the local recon phase that feeds Privilege Escalation.
What the attacker gains
Section titled “What the attacker gains”Enumeration doesn’t grant root on its own: it builds the map that makes it possible. The mental order is always the same:
- Who am I and what can I do? — user, groups,
sudo -l. - What’s locally exploitable? — SUID, caps, cron, kernel, permissions.
- What else do I reach? — reusable credentials, other subnets, other hosts.
Stabilize the shell first (full TTY, see CLI and shells) so sudo, editors, and interactive tools work.
Theory / What to look at and why
Section titled “Theory / What to look at and why”Enumeration answers escalation questions. It’s not about dumping everything, but cross-referencing each fact with a known vector: a kernel version with a CVE, a SUID binary with its GTFOBins entry, a group equivalent to root.
Red Team
Section titled “Red Team”User context
Section titled “User context”id; whoami; groups # user, UID/GID, groups (docker? sudo? adm?)sudo -l # what I can run as root (key; see lin-sudo)cat /etc/passwd # system users and valid shellscat /etc/group # interesting membershipscat ~/.bash_history; history # prior commands (sometimes credentials)Juicy groups: sudo, wheel, docker (=root, see Docker), lxd, adm (logs), disk, shadow.
System and kernel
Section titled “System and kernel”uname -a # kernel and architecture (see lin-kernel)cat /etc/os-release # distro and version (affects backports)cat /proc/version; archCross-reference the kernel version with known exploits (Dirty COW CVE-2016-5195, Dirty Pipe CVE-2022-0847, PwnKit CVE-2021-4034 in polkit).
Processes, services, and tasks
Section titled “Processes, services, and tasks”ps aux --forest # processes and as whom they runss -tulpn # listening ports (internal services, pivoting)systemctl list-units --type=service --state=runningcat /etc/crontab; ls -la /etc/cron.* # tasks (see lin-cron)systemctl list-timers --all # systemd timerscat /etc/fstab # mounts (NFS no_root_squash, CIFS with creds)File and permission privesc vectors
Section titled “File and permission privesc vectors”find / -perm -4000 -type f 2>/dev/null # SUID (see lin-suid)find / -perm -2000 -type f 2>/dev/null # SGIDgetcap -r / 2>/dev/null # capabilities (see lin-caps)find / -writable -type d 2>/dev/null # writable directoriesfind / -perm -o+w -type f 2>/dev/null # world-writable filesgrep -riE 'password|secret|api[_-]?key' /etc /var/www /opt 2>/dev/nullLoose credentials (quick wins)
Section titled “Loose credentials (quick wins)”cat ~/.ssh/id_* ~/.ssh/authorized_keys 2>/dev/null # SSH keyscat ~/.aws/credentials ~/.kube/config 2>/dev/null # cloud/k8sfind / \( -name "*.conf" -o -name "*.env" \) 2>/dev/null | xargs grep -lI pass 2>/dev/nullcat /var/www/*/wp-config.php /var/www/*/config* 2>/dev/nullFull detail in Credential Theft.
Network and pivoting
Section titled “Network and pivoting”ip a; ip route; arp -a # interfaces, routes, neighbors (other subnets?)ss -tulpn # internal services not exposed outsidecat /etc/hosts /etc/resolv.confAutomated tools
Section titled “Automated tools”- linpeas.sh (PEASS-ng): the all-in-one enumerator; highlights likely vectors in color. Almost mandatory.
- linux-smart-enumeration (
lse.sh) and LinEnum.sh: lighter alternatives. - pspy: spies on root processes/cron without privileges; gold for seeing what root launches.
If stealth is critical, enumerate by hand with native binaries (see Living off the Land) instead of uploading linpeas.
Blue Team
Section titled “Blue Team”Detection
Section titled “Detection”- auditd/eBPF: bursts of
find / -perm,getcap -r /, mass/etcreads, execution oflinpeas/pspy/lse.sh. - SIEM: correlate post-exploitation recon (many config
cats,id,sudo -l,uname) from the same session in a short window (see detection). - Linux EDR that detects the enumeration chain, not just file signatures.
Telemetry
Section titled “Telemetry”Execution logs (auditd execve), access to sensitive files (/etc/shadow, keys), and ephemeral processes captured by eBPF/Falco.
Hardening
Section titled “Hardening”- Least privilege: no unnecessary SUID/sudo, no dangerous groups.
- No credentials in files/configs (managed secrets, 600 permissions).
- Kernel and packages up to date; AppArmor/SELinux to confine.
- Execution logging enabled and centralized.
Checklist
Section titled “Checklist”-
id,sudo -l, groups (docker/lxd/sudo/adm/disk) - Kernel and distro → map exploits (Kernel Exploits)
- SUID/SGID and capabilities (SUID/SGID, capabilities)
- Cron, timers, and services with writable scripts (Cron)
- World-writable files/directories
- Credentials in configs, histories, SSH/AWS keys (credentials)
- Network: other reachable subnets (pivoting)
- linpeas + pspy to miss nothing