I am trying to recreate a buffer overflow attack in my machine using Ubuntu 16.04. But no matter what I try I always get the error 'Segmentation fault(core dumped)'
I already disabled memory randomization by using:
sysctl kernel.randomize_va_space=0
And I have also tried these flags when compiling my program:
-fno-stack-protector
-z execstack
-D_FORTIFY_SOURCE=0
Adding all these flags I end up compiling the following:
gcc -z execstack -g -fno-stack-protector -mpreferred-stack-boundary=2 -D_FORTIFY_SOURCE=0 -o code code.c
But nothing seems to work. Is there any other protection I need to disable in order to recreate my buffer overflow successfully?