Created
March 6, 2018 00:26
-
-
Save TheButlah/794ab2ad3266503b0d0e5a92a944bf80 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> | |
extern char** environ; | |
int main() { | |
printf("(%d->%d):(%d->%d)\n", getuid(), geteuid(), getgid(), getegid()); | |
setuid(geteuid()); | |
setgid(getegid()); | |
printf("(%d->%d):(%d->%d)\n", getuid(), geteuid(), getgid(), getegid()); | |
char* n = "/bin/sh"; | |
char* newargs[] = {n, NULL}; | |
execve(n, newargs, environ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment