Skip to content

Instantly share code, notes, and snippets.

@rkujawa
Created August 29, 2017 21:42
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 rkujawa/366a3225fb444cfa260acb037e09c8a3 to your computer and use it in GitHub Desktop.
Save rkujawa/366a3225fb444cfa260acb037e09c8a3 to your computer and use it in GitHub Desktop.
fooapp - C source
#include <stdio.h>
#include <unistd.h>
int
main(int argc, char *argv)
{
printf("let's try to run execve!\n");
execve("/bin/sh", 0, 0);
/* if we are here, it means execve failed in some way */
perror("couldn't execve: ");
}
/*
$ fooapp
let's try to run execve!
couldn't execve: : Permission denied
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment