Created
March 28, 2016 08:44
-
-
Save CreateRemoteThread/5675f90742175563127d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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