Skip to content

Instantly share code, notes, and snippets.

@jeremyroman
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save jeremyroman/9020756 to your computer and use it in GitHub Desktop.

Select an option

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