Linux Capabilities are a fine-grained alternative to SUID. Instead of giving a binary full root powers, capabilities grant specific privileges. But when dangerous capabilities are assigned, they create privilege escalation paths just like SUID.
Think of capabilities like security clearances. SUID is like having a "TOP SECRET ALL ACCESS" badge. Capabilities are like having "TOP SECRET for NETWORK only" - more restricted, but if that specific clearance lets you do something dangerous (like change any user ID), you can still escalate.
Beyond SUID
Capabilities are Linux's answer to "why give ping full root when it only needs network access?" But misconfigured capabilities are just as dangerous as misconfigured SUID.
Understanding Capabilities
Dangerous Capabilities
CAP_SETUID allows changing to UID 0 (root). CAP_DAC_OVERRIDE bypasses all file permissions. CAP_SYS_ADMIN has so many abilities it's almost as dangerous as root.
Finding Capabilities
Always Check Capabilities
Capabilities are often overlooked in CTFs because SUID is more well-known. Always run getcap -r / - you might find an easy path others miss.
Exploiting CAP_SETUID
CAP_SETUID is the jackpot - the binary can change its user ID to anyone, including root (UID 0).
Compiled Binary with CAP_SETUID
Exploiting DAC Capabilities
CAP_DAC_READ_SEARCH
CAP_DAC_OVERRIDE
Other Dangerous Capabilities
CAP_SYS_ADMIN
CAP_SYS_PTRACE
CAP_CHOWN
CAP_FOWNER
Real-World Examples
How Capabilities Are Set
Capabilities Exploitation Methodology
Capabilities Attack Flow
1
Enumerategetcap -r / 2>/dev/null
2
IdentifyFind dangerous caps (setuid, dac_override)
3
ResearchCheck GTFOBins for the binary
4
UnderstandKnow what the capability allows
5
ExploitUse appropriate technique for the cap
6
VerifyConfirm privilege escalation worked
Knowledge Check
Challenges
Key Takeaways
- Capabilities are fine-grained privileges (alternative to SUID)
- Find them with: getcap -r / 2>/dev/null
- CAP_SETUID = instant root via setuid(0)
- CAP_DAC_OVERRIDE = read/write any file
- Interpreters with cap_setuid are easiest to exploit
- Often overlooked - always check during enumeration