Exploit mitigations: ASLR to CET

What each mitigation breaks and how it is bypassed: DEP and W^X, ASLR and PIE, stack canaries, RELRO and FORTIFY_SOURCE, control-flow integrity, Intel CET shadow stacks and IBT, Arm PAC, BTI and MTE, and hardened allocators.

🔒 PROBy ·Lesson·11 min read·Advanced → Staff
ASLRDEP NXstack canarycontrol-flow integrityIntel CET shadow stackARM MTE

01The classic trio: DEP, ASLR and stack canaries

✓What you will learn
  • Explain what DEP/NX, ASLR and stack canaries each prevent and how each is bypassed
  • Turn on compiler and linker hardening (PIE, RELRO, FORTIFY_SOURCE) and verify it
  • Distinguish forward-edge and backward-edge CFI and map CFG, Clang CFI, CET and PAC onto them
  • Explain memory tagging and hardened allocators as probabilistic memory safety

Each mitigation targets one step of the exploit chain. None fixes the bug; they raise the cost of turning a bug into reliable code execution. Understanding what each one assumes is how you judge whether it helps for a given bug.

MitigationWhat it doesWhat it stopsStandard bypass
DEP / NX / W^XMarks stack and heap non-executable; pages are writable or executable, not bothInjecting shellcode into a buffer and jumping to itCode reuse: return-oriented programming (ROP) chains existing instructions
ASLRRandomises base addresses of stack, heap, libraries and (with PIE) the programHard-coded addresses in exploitsAn information leak, or brute force where entropy is low (32-bit, forking servers that do not re-randomise)
Stack canaryRandom value between locals and the saved return address, checked before returnLinear stack overflows reaching the return addressLeak the canary, overwrite a pointer before return, or use a non-linear write

ROP is the reason the other mitigations exist. With DEP, attackers stopped injecting code and started chaining short instruction sequences ending in ret (gadgets) already present in the binary and its libraries. Each gadget does a little work and returns into the next. Given enough code, ROP is Turing-complete. ASLR fights ROP by hiding where gadgets are; CFI and shadow stacks fight it by restricting where returns and indirect jumps may go.

This is an advanced module

Vulnerability research & exploit mitigations is part of the Pro pass. 4 more sections — the deep dives, the final design, follow-ups and the test — unlock with it.

Already a cyart.io or studio.cyart.io member? Your pass code is in your Studio account.