Skip to content
Pwnversity
LIN-ENUMbasic · 5 min · upd. 2026-10

Linux Enumeration

T1082T1083

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.

Enumeration doesn’t grant root on its own: it builds the map that makes it possible. The mental order is always the same:

  1. Who am I and what can I do? — user, groups, sudo -l.
  2. What’s locally exploitable? — SUID, caps, cron, kernel, permissions.
  3. 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.

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.

Ventana de terminal
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 shells
cat /etc/group # interesting memberships
cat ~/.bash_history; history # prior commands (sometimes credentials)

Juicy groups: sudo, wheel, docker (=root, see Docker), lxd, adm (logs), disk, shadow.

Ventana de terminal
uname -a # kernel and architecture (see lin-kernel)
cat /etc/os-release # distro and version (affects backports)
cat /proc/version; arch

Cross-reference the kernel version with known exploits (Dirty COW CVE-2016-5195, Dirty Pipe CVE-2022-0847, PwnKit CVE-2021-4034 in polkit).

Ventana de terminal
ps aux --forest # processes and as whom they run
ss -tulpn # listening ports (internal services, pivoting)
systemctl list-units --type=service --state=running
cat /etc/crontab; ls -la /etc/cron.* # tasks (see lin-cron)
systemctl list-timers --all # systemd timers
cat /etc/fstab # mounts (NFS no_root_squash, CIFS with creds)
Ventana de terminal
find / -perm -4000 -type f 2>/dev/null # SUID (see lin-suid)
find / -perm -2000 -type f 2>/dev/null # SGID
getcap -r / 2>/dev/null # capabilities (see lin-caps)
find / -writable -type d 2>/dev/null # writable directories
find / -perm -o+w -type f 2>/dev/null # world-writable files
grep -riE 'password|secret|api[_-]?key' /etc /var/www /opt 2>/dev/null
Ventana de terminal
cat ~/.ssh/id_* ~/.ssh/authorized_keys 2>/dev/null # SSH keys
cat ~/.aws/credentials ~/.kube/config 2>/dev/null # cloud/k8s
find / \( -name "*.conf" -o -name "*.env" \) 2>/dev/null | xargs grep -lI pass 2>/dev/null
cat /var/www/*/wp-config.php /var/www/*/config* 2>/dev/null

Full detail in Credential Theft.

Ventana de terminal
ip a; ip route; arp -a # interfaces, routes, neighbors (other subnets?)
ss -tulpn # internal services not exposed outside
cat /etc/hosts /etc/resolv.conf
  • 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.

  • auditd/eBPF: bursts of find / -perm, getcap -r /, mass /etc reads, execution of linpeas/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.

Execution logs (auditd execve), access to sensitive files (/etc/shadow, keys), and ephemeral processes captured by eBPF/Falco.

  • 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.
  • 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