Search code examples
csecuritystackbuffer-overflow

Executable vs NX stack in BOF?


I'm reading about BOF(buffer overflow) attack, one way to prevent it is by making stack or heap non executable. But that doesn't mean that we can't have a local variable. I did't see a new behavior by making the stack non executable. What is the major difference between Executable and NX stack, in terms of BOF?


Solution

  • I have now grasp what executable stack mean, computer instructions are stored in .text section. Stack sections contains function arguments, local variables, we can also store instructions since they are byte code. But by default CPU won't execute instructions stored on the stack so to make CPU to execute our code stored on the stack we have to tell by making stack executable.

    gcc -m32 -z execstack -o shell  exploit.c