The Mitigation Stack: Which Defenses, In Order
Every exploit walks the same stages: bug, corruption, hijack, code execution, escalation. A defender's checklist of which mitigation stops each — across Linux, ARM, Windows and the kernel.
This is the capstone of the Exploit Mitigations area. Every walkthrough on this site ends by re-enabling the mitigation that breaks it. Read together, those endings form a single picture: an exploit is a chain of stages, and a defender's job is to break as many stages as possible. This guide assembles that picture across Linux, ARM, Windows and the kernel, and gives a prioritized order to enable everything.
Every exploit walks the same stages
Whatever the platform, memory-corruption exploitation follows the same path. Break any link and the chain fails.
1. Bugan unbounded copy, a lifetime error, a bad index2. Memory corruptionoverwrite a return address, pointer, or metadata3. Know where to aimdefeat ASLR/PIE, usually via a leak4. Control-flow hijackseize the instruction pointer5. Code execution / reuseshellcode, ROP, ret2libc, one-gadget6. Privilege escalationcommit_creds, sandbox escapeWhich mitigation breaks which stage
The same stage has a different mitigation name on each platform, but the role is identical.
| Stage | Linux x86-64 | ARM64 | Windows | Kernel |
|---|---|---|---|---|
| 1. Prevent the bug | memory-safe language, -Wall -Wformat=2, sanitizers in CI | same | same, /analyze | same, subsystem hardening |
| 2. Detect corruption | stack canary, FORTIFY_SOURCE | stack canary | /GS cookie | CONFIG_STACKPROTECTOR_STRONG, freelist hardening |
| 3. Hide addresses | ASLR + PIE | ASLR + PIE | ASLR (/DYNAMICBASE) | KASLR + kptr_restrict |
| 4. Protect return edge | shadow stack / CET | PAC | CET (/CETCOMPAT), SEHOP | shadow stack, canary |
| 5a. No injected code | NX | NX | DEP (/NXCOMPAT) | SMEP |
| 5b. Constrain reuse | CFI, Full RELRO | BTI | CFG | kernel CFI, SMEP/SMAP |
| 6. Contain the win | seccomp, least privilege | seccomp | ACG/CIG, AppContainer | KPTI, lockdown, seccomp |
Each row is one link. The techniques that attack each are catalogued in the Exploitation Techniques, ARM64, Windows and Kernel areas.
A prioritized enablement order
For a C or C++ project, enable in this order — cheapest and most universal first:
- Compile-time hygiene.
-Wall -Wextra -Wformat=2 -Werror=format-security; treat warnings as errors. This alone prevents format-string bugs from shipping. - The four cheap classics. Stack canary (
-fstack-protector-strong), NX, ASLR + PIE (-fPIE -pie), and Full RELRO (-Wl,-z,relro,-z,now). Each breaks a distinct stage; see binary hardening flags. - FORTIFY_SOURCE.
-D_FORTIFY_SOURCE=3 -O2adds bounds checks to common libc calls and blocks%nin writable format strings. - The backward edge in hardware. Intel CET shadow stack, or ARM PAC (
-mbranch-protection=standardalso enables BTI). This is the most direct answer to ROP. - Find bugs continuously. AddressSanitizer and fuzzing in CI. Mitigations do not fix bugs; this is how you remove them.
- Contain what remains. seccomp for exposed services (see the ORW guide), least privilege, and sandboxing.
- Remove the bug class. Where feasible, write new components in a memory-safe language. This is the only measure that eliminates stages 1–2 entirely.
Verify, don't assume
A flag that is silently dropped protects nothing. Confirm what actually shipped:
- Linux/ARM:
checksec --file=./bin(canary, NX, PIE, RELRO);readelf -nfor ARMBTI, PAC. - Windows: check
/guard:cf,/DYNAMICBASE,/NXCOMPAT,/CETCOMPATon every loaded module — one unhardened DLL is the usual gap. - Kernel: verify KASLR, SMEP/SMAP (
/proc/cpuinfo), KPTI, and theCONFIG_*hardening options in the running config.
Key takeaways
- Exploitation is a chain of stages: bug → corruption → address knowledge → control-flow hijack → code execution/reuse → escalation. Breaking any stage stops the exploit.
- The same stage has a different mitigation name per platform, but the role is identical — use the cross-reference table to see the whole grid.
- Enable in cost order: compile-time hygiene, the four classics (canary/NX/PIE/RELRO), FORTIFY, the hardware backward edge (CET/PAC), sanitizers+fuzzing, containment, and finally memory-safe languages.
- Verify every mitigation actually shipped, on every module — a dropped flag is a silent gap.
This capstone ties together the whole site: the vulnerability classes, the exploitation, ARM64, Windows and kernel techniques, and the mitigations that answer each.