I wonder why countermeasures against code-injection and control-flow hijacking attacks (e.g. stack-based buffer overflows and heap-based buffer overflows) are mostly implemented in software.

Examples of popular and widely deployed countermeasures are:
- Stack canaries
- Non-executable memory regions

But why exactly are these countermeasures not completely implemented in hardware, or at least supported by hardware? Since nowadays reconfigurable hardware (e.g. FPGA's) is affordable, this approach seems perfectly possible to me.

Or do hardware-based countermeasures exist? And if so, can anyone give me some examples?

  • I think what you are referring to is firmware (code that links physical hardware to high-level coding languages). There are many reasons for the 'countermeasures' to be implemented at higher levels. Also bear in mind that most attacks originate from these higher levels. May 30, 2014 at 4:06

1 Answer 1


Non-executable memory regions are an example of a hardware-based countermeasure: the non-executability of the memory is enforced by the memory management unit. Heap overflow protection can also be implemented at the hardware level (by placing non-readable memory pages at the ends of a heap allocation), but usually isn't, because it greatly reduces the available address space and only works for allocations that are an exact multiple of the page size.

Most countermeasures are implemented at the software level because the concepts they involve (such as address space layout) only exist at the software level.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .