Skip to content

Instantly share code, notes, and snippets.

@CreateRemoteThread
Created March 28, 2016 08:44
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 CreateRemoteThread/5675f90742175563127d to your computer and use it in GitHub Desktop.
Save CreateRemoteThread/5675f90742175563127d to your computer and use it in GitHub Desktop.
/*
* buf1.c
* demonstrating a simple bufferoverflow
*
* by pasteBin (Jordan)
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char *argv[]){
printf("Enter some stuff:");
fflush(stdout);
char buf[16];
int magic = 1;
scanf("%s",buf);
printf("You entered %s \nmagic = %d\n", buf, magic);
if (magic == 'T'){
printf("Now the magic is really happening\n");
fflush(stdout);
execve("/bin/sh", NULL, NULL);
}
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment