0xRick/0xRick.github.io

Protostar Stack0 different behavior

gianpyc opened this issue · 1 comments

Hi,
I'm following your blog pages on the buffer overflow and I'm trying to reproduce it on a VM with ubuntu 20.04.
In the specific case of stack0 example, I compile it for 32bit architecuture with the command
gcc -m32 stack0.c -o stack0
and I get the executable. Then, if I run with the command:
python -c "print ('A' * 65 )"| ./stack0

I get:
Try again? *** stack smashing detected ***: terminated Aborted (core dumped)

I got the buffer overflow but I should get the print saying the I modified the variable.
So, it seems that the variable is not overwritten, where am I wrong?

I reply myself...
fixed by compiling the source code disabling canaries with -fno-stack-protector option when invoking gcc.
So, the resulting command is for instance:
gcc -m32 stack0.c -o stack0 -fno-stack-protector