0

I'm currently using nested functions (which is extensions to C in GCC), however that is not supported (and is not planned to be supported) in clang. Mostly on the grounds that executable stack is dangerous and I would like to understand why exactly.

Is there something inherently dangerous about it?

2

In case of stack based buffer overflow exploits attackers typically control parts of the stack (that's how she triggers the overflow in the first place). After gaining control over the program counter it would be very convenient for the attacker to resume execution on attacker controlled data on the stack, which is only possible if the stack is executable. Marking the stack non-executable is part of the W^X policy: when implemented, the attacker can only control non-executable memory, making direct injection of executable code impossible.

Attackers usually overcome this mitigation by reusing existing executable code from the target program using techniques like return-to-libc or ROP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.