SUID (Set User ID) is a special permission that makes executables run as their owner rather than the user executing them. When a SUID binary is owned by root, ANY user runs it as root. This legitimate feature becomes a security issue when misused.
Think of SUID like a special badge that says "treat me as the owner." The "passwd" command needs SUID to modify /etc/shadow (owned by root) on behalf of regular users. But give SUID to vim? Now anyone can edit any file as root.
Legitimate vs Dangerous
SUID exists for good reasons (passwd, ping, mount). The danger is when SUID is set on binaries that can execute commands, read files, or spawn shells - those become instant root access.
Understanding SUID
Real vs Effective UID
Finding SUID Binaries
Common Legitimate SUID
GTFOBins Reference
GTFOBins (gtfobins.github.io) is your bible for SUID exploitation. It lists Unix binaries that can be exploited for privilege escalation when they have SUID or sudo permissions.
Always Check GTFOBins
When you find a SUID binary, immediately check GTFOBins. Even seemingly harmless binaries might have exploitation methods you wouldn't think of.
Basic SUID Exploitation
Shell Escape from Editors
Command Execution
File Read/Write
Use -p Flag
Many shells drop privileges when spawned. The -p flag (bash -p) preserves effective UID. Without it, you might get a shell that's back to your normal user!
Identifying Custom SUID
SUID Enumeration Methodology
SUID Attack Flow
1
Findfind / -perm -4000 -type f 2>/dev/null
2
ListRemove known safe binaries from list
3
ResearchCheck each unknown binary on GTFOBins
4
AnalyzeFor custom binaries, use file/strings/strace
5
ExploitUse appropriate technique for the binary
6
VerifyConfirm root access with id command
Knowledge Check
Challenges
Key Takeaways
- SUID makes binaries run as their owner (often root)
- Find SUID with: find / -perm -4000 2>/dev/null
- Always check GTFOBins for exploitation methods
- Use -p flag to preserve privileges in spawned shells
- Custom SUID binaries are often misconfigured
- Shell escapes (vim, less) provide root shells from SUID editors