Lesson 1 of 9 · 24m
The Linux Privilege Model and Enumeration That Matters
Model users, groups, processes, files, and credentials as privilege boundaries, then enumerate the few facts that change exploitation decisions.
Privilege escalation is not magic. It is the process of crossing one boundary the system already trusts: user to user, user to group, process to root, container to host, or one service account to another. New testers collect thousands of lines of enumeration output and miss the one line that matters. Seniors start with the trust model and let the model choose the checks.
Draw the boundary first
On a Linux host, privilege is a relationship between a process and an object. The process carries user IDs, group IDs, capabilities, a root directory, namespaces, and a security module context. The object carries ownership, permissions, ACLs, mount properties, and sometimes extended attributes.
id
ps -eo user,uid,gid,comm,args --forest | head -40
cat /proc/self/status | grep -E '^(Uid|Gid|Groups|Cap|NoNewPrivs|Seccomp)'A shell running as www-data is not "almost root." It is a process with specific authority. Your job is to find where that authority is accepted by something stronger: sudo, a setuid binary, a writable root-owned script, an exposed credential, a service manager socket, or the kernel itself.
Enumerate facts, not noise
These commands answer exploitation questions quickly:
uname -a
cat /etc/os-release
sudo -l 2>/dev/null
find / -perm -4000 -type f 2>/dev/null | sort
getcap -r / 2>/dev/null
crontab -l 2>/dev/null
ls -la /etc/cron.d /etc/cron.daily /var/spool/cron 2>/dev/null
find / -writable -type f 2>/dev/null | grep -Ev '^/(proc|sys|dev|run)' | head -100
mount | grep -E 'noexec|nosuid|nodev'Do not paste all of this into a report. Use it to answer: what can I execute as someone else, what privileged code trusts input I control, and what maintenance automation runs predictably?
Groups are lateral privilege
Group membership is often forgotten because it is not a root shell. It is still privilege:
id traven
# uid=1000(traven) gid=1000(traven) groups=1000(traven),27(sudo),124(docker),998(lxd)sudo is obvious. docker and lxd are usually root-equivalent because those daemons control host resources. adm can read logs that leak secrets. disk may read raw block devices. shadow can read password hashes. A junior tester says "no sudo rights" while sitting in a group that owns the machine.
Credentials and trust stores count too
Linux privilege escalation is not limited to executable tricks. Readable private keys, cloud metadata credentials, database passwords reused for a user account, backup archives, shell history, configuration management secrets, and environment files often cross the same boundary with less forensic noise.
ls -la ~/.ssh 2>/dev/null
grep -R --binary-files=without-match -E 'password|token|private_key' /etc 2>/dev/null | head
env | sortBe careful with scope. Reading /etc/shadow proves access; cracking every hash in it may not. Reading a key proves exposure; using it against another host may require separate authorization.
Field notes
- Kernel version is context, not an exploit decision. Backported patches make version-only matching unreliable.
find / -writableis noisy on purpose; compare paths against ownership and consumers, not just writability.- Enumeration scripts are useful as memory aids, not substitutes for judgment. Read the outliers.
- Never assume a container escape is required. Often the container runtime socket or cloud credential is already the escape.
- Write down exactly which boundary you crossed. Defenders cannot fix "got root somehow."
Was this lesson helpful?