Last active
January 28, 2019 17:15
-
-
Save int0x33/8050c50bb516d4abc515ede1e2e1b2a8 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 <stdlib.h> | |
#include <unistd.h> | |
#include <string.h> | |
#include <sys/types.h> | |
#include <stdio.h> | |
int main(int argc, char **argv, char **envp) | |
{ | |
char *buffer; | |
gid_t gid; | |
uid_t uid; | |
gid = getegid(); | |
uid = geteuid(); | |
setresgid(gid, gid, gid); | |
setresuid(uid, uid, uid); | |
buffer = NULL; | |
asprintf(&buffer, "/bin/echo %s is cool", getenv("USER")); | |
printf("about to call system(\"%s\")\n", buffer); | |
system(buffer); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment