Created
June 11, 2018 17:24
-
-
Save fgsahoward/17bbe38a0fa03cc2d34de747f0e77603 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| /** | |
| * Compile: | |
| * 32-bit: | |
| * gcc -o med32 -m32 -fno-stack-protector med.c | |
| * 64-bit: | |
| * gcc -o med64 -fno-stack-protector med.c | |
| * | |
| * Turn off ASLR: | |
| * sudo systctl -w kernel.randomize_va_space=0 | |
| **/ | |
| #include <string.h> | |
| #include <unistd.h> | |
| #include <stdlib.h> | |
| #include <stdio.h> | |
| void vulnerable() { | |
| char buf[1024]; | |
| memset(buf, 0x0, 1024); | |
| write(1, "Enter some text: ", 17); | |
| read(0, buf, 2048); | |
| printf("Your string: %s", buf); | |
| } | |
| int main(int argc, char * argv[], char * envp[]) { | |
| vulnerable(); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment