Skip to content

Instantly share code, notes, and snippets.

@kgadek
Last active August 29, 2015 14:04
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 kgadek/923bf91332f51f50e878 to your computer and use it in GitHub Desktop.
Save kgadek/923bf91332f51f50e878 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <unistd.h>
int main(int c, char **v, char **e) {
int rc; const char *m;
if ( (m="chdir" ,rc= chdir(v[1]) ) == 0
&& (m="chroot",rc=chroot(v[1]) ) == 0
&& (m="setuid",rc=setuid(getuid())) == 0 )
m="execve", execve(v[2],v+3,e);
perror(m);
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment