Authentication, Passwords and Privilege Escalation · PTES: Exploitation
L18. Linux Privilege Escalation Basics
Enumerate common Linux privilege escalation paths on a practice machine and explain the difference between a foothold and administrative control.
Lesson 18 of 21 · About 35 minutes including the lab
By the end of this lesson you can
- Define privilege escalation and map it to ATT&CK TA0004.
- Enumerate OS, user, sudo and SUID basics on a Linux lab host.
- Use GTFOBins as a reference for abuse of legitimate binaries.
- Explain why post-exploitation still needs rules of engagement.
Video transcript
You have a low privilege shell in a lab. How do you become root? Privilege escalation turns limited access into higher privileges, through a misconfiguration or a flaw. On Linux, start by listing what your user is allowed to do. Run sudo -l to list the commands your user may run as root. Search for programs with the set user ID bit, which run with their owner’s rights. Compare what you find with GTFOBins, which documents how common programs can be abused. A program allowed through sudo can often open a root shell. Users get only the commands they need, and nothing that spawns a shell. Practice on TryHackMe or Hack The Box machines. Enumerate before you exploit anything. Report the misconfiguration, not just the root shell. Most escalations start with too much trust. Practice in the knowledge check.
Course outlineLesson 18 of 21
Lesson notes
Privilege escalation means going from the access you have to higher access, typically from a normal user to root or Administrator. In ATT&CK this is tactic TA0004. On a penetration test you do this only when the RoE allows post-exploitation, and you stop at the agreed goal (for example, prove root access) rather than browsing sensitive files.
A foothold is the first code execution or shell you get. Escalation turns that foothold into control of the host or domain. Clients care about both: a foothold without escalation may still expose data, and escalation without a clear path from the internet may still matter for insider threats.
On Linux, start with whoami, id, uname -a and cat /etc/os-release. Then check sudo -l for commands your user may run as root, and look for setuid binaries with find / -perm -4000. GTFOBins documents how many legitimate binaries can be abused when writable or callable with elevated rights. On Windows, the equivalent references include Seatbelt, WinPEAS and the LOLBAS project; this beginner course stays on Linux.
Automated helpers such as LinPEAS speed enumeration but produce a lot of noise. Run them only on lab machines or when the RoE allows, and verify every interesting finding manually before reporting it.
Common Linux paths include: sudo rights to a shell-escapeable binary, a setuid binary that can read files or spawn a shell, writable cron jobs, writable service files, exposed SSH keys and kernel exploits. Kernel exploits are last resorts: they can crash the host, which often violates RoE.
Commands and expected output
Who am I and what groups do I belong to?
idOutput
uid=1000(box) gid=1000(box) groups=1000(box)Real sample output. uid 0 would mean root. Membership in groups such as sudo or docker is often a lead.
List sudo rights for the current user
sudo -lShows which commands you may run as other users. (ALL) ALL means full root via sudo. A single allowed binary may still be enough if GTFOBins shows a shell escape. Requires your lab user’s sudo password if one is set.
Find setuid binaries
find / -xdev -perm -4000 -type f 2>/dev/nullOutput
/usr/bin/passwd
/usr/bin/sudo
/usr/bin/mount
...Real truncated output from a Linux host. -xdev stays on one filesystem. Many setuid binaries are normal; check unusual or writable ones against GTFOBins before claiming a finding.
Hands-on labs
Practice only on these legal targets: your own local lab or machines a platform assigns to you. Never use these techniques on systems you do not have written permission to test.
TryHackMe
Linux Privilege EscalationComplete the Linux Privilege Escalation room. Practice sudo -l and SUID enumeration on the machine it provides.
Hack The Box
Starting Point: escalate on a Tier 1 machineOn a Starting Point machine that awards a root flag, escalate only as far as the write-up goals require and document the path.
Your local lab
Read GTFOBins for find and tarOpen the GTFOBins entries for find and tar. Explain in your notes how each could help if sudo allowed that binary without a password.
Practice task
On a TryHackMe or HTB Linux machine you are authorized to use, collect id, sudo -l and a filtered find of setuid binaries. Write a short note naming the most promising path and the ATT&CK technique ID that fits it.
Key takeaways
- Privilege escalation moves from a foothold to higher privileges (ATT&CK TA0004).
- Enumerate with id, sudo -l and setuid searches before running exploit code.
- GTFOBins documents abuse of legitimate Linux binaries.
- Stay within post-exploitation rules: prove the goal, do not ransack the host.
Framework mapping
Sources and further reading
1. What does privilege escalation mean on a penetration test?
2. Which command shows the sudo rights of the current user?
3. What is GTFOBins?
4. Why are kernel exploits a last resort during a client engagement?