Skip to content

Instantly share code, notes, and snippets.

@metametaclass
Last active October 23, 2021 13:19
Show Gist options
  • Save metametaclass/12543c58b0f33ec910381810977eb6ad to your computer and use it in GitHub Desktop.
Save metametaclass/12543c58b0f33ec910381810977eb6ad to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main(){
int x[1];
int i = 3;
asm("int $3"); // force debugger break
x[i] = 123; // corrupt stack
printf("%d\n",x[i]); // check if this really "works"
return 0;
}
$ gcc -fstack-protector-all -o t.exe t.c
$ ./t.exe
123
$ echo $?
0
>file t.exe
t.exe: PE32 executable for MS Windows (console) Intel 80386 32-bit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment