Classic Buffer overflow exploits on Linux x64
If you are learning buffer overflow exploit development on Linux x64 machine, then there are something which you need to take care of.
This is because architecture and execution of programs in x64 machine model is completely different from x32 machine model.
For a reference to stack frame in x64, refer to this link
Consider this C program and I will demonstrate the effect of compiling this program for x32 and x64.
If you are on x64, simply executing this command will compile it for x64
And this one for x32
Let’s try to exploit this buffer overflow vulnerability using gdb on both the versions. Here are the outputs
As you can see in the outputs above, there is no EIP register in x64 version of program. And in the x32 version, the EIP value is correctly corrupted with our overflowed value of x41.