Standard SUID binaries are easy - check GTFOBins. But what about custom SUID binaries written by developers? These require reverse engineering and analysis to find vulnerabilities - and they're often full of them.Related
Think of it like this: GTFOBins covers the "factory-installed" locks. Custom SUID binaries are homemade locks - often designed by people who don't specialize in security. They frequently have vulnerabilities like buffer overflows, improper input handling, or insecure function calls.
CTF Favorites
Custom SUID binaries are extremely common in CTFs and pentests. If you find an unfamiliar SUID binary, it's probably the intended path to root. Time to analyze!
Identifying Custom SUID Binaries
Non-Standard Paths = Investigate
If a SUID binary is in /opt, /home, /usr/local, or any non-standard location, it's almost certainly custom and worth investigating thoroughly.
Analyzing Custom Binaries
What to Look For
PATH Variable Exploitation
Always Check PATH Usage
If ltrace or strings shows commands without full paths (service, tar, cat, etc.), PATH manipulation is likely possible. This is one of the most common custom SUID vulnerabilities.
Command Injection
Bypassing Filters
Environment Variable Exploitation
Library Hijacking
Buffer Overflow Basics
Buffer Overflow Complexity
Buffer overflow exploitation is a whole discipline. This lesson covers detection. For full exploitation, study binary exploitation (pwn) separately. Many CTFs have simpler intended paths anyway.
Symlink Attacks
Custom SUID Analysis Methodology
Custom SUID Binary Analysis
1
IdentifyFind custom SUID in non-standard paths
2
StringsLook for commands, paths, functions
3
LtraceWatch library calls, especially system()
4
PATH TestIf relative commands, try PATH manipulation
5
InjectionTest inputs for command injection
6
OverflowTest large inputs for crashes
Knowledge Check
Challenges
Key Takeaways
- Custom SUID binaries in non-standard paths warrant investigation
- Use strings, ltrace, and strace to analyze binary behavior
- PATH manipulation works when binaries use relative command names
- Test for command injection with ; | && and backticks
- Check for buffer overflows with large inputs
- Environment variables and symlinks are additional attack vectors