Skip to content

Instantly share code, notes, and snippets.

@int0x33
Last active January 28, 2019 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save int0x33/8050c50bb516d4abc515ede1e2e1b2a8 to your computer and use it in GitHub Desktop.
Save int0x33/8050c50bb516d4abc515ede1e2e1b2a8 to your computer and use it in GitHub Desktop.
#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