Why is it more difficult for an attacker to change the code compared the JIT?
Re:Self-modifying code using GCC (2011)
by matheusmoreira on Monday August 07, 2023 @09:41PM
(#37043414)
Attackers love overflowing buffers but since that memory is not executable they can't put code in there directly. The JIT compiler is almost always the only component which writes to executable pages so they need to somehow trick it into emitting the code they want. It's my understanding that JIT spray attacks are harder to develop.
Some systems apparently allow you to add executable without removing write as that is what the OP does with "mprotect(page, getpagesize(), PROT_READ | PROT_WRITE | PROT_EXEC);". However,