Skip to content

Instantly share code, notes, and snippets.

@jeremyroman
Last active August 29, 2015 13:56
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 jeremyroman/9020756 to your computer and use it in GitHub Desktop.
Save jeremyroman/9020756 to your computer and use it in GitHub Desktop.
setuid by id
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char* argv[]) {
uid_t uid = (uid_t) atoi(argv[1]);
setuid(uid);
execl("/bin/sh", "sh", (char*) 0);
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment