WCU / Cybersecurity
~/CSC 472/Class 05/KP 04
Class 05 · KP 04 / 19

NX / DEP: No Execute

  • Problem it kills: classic attack writes shellcode into a buffer (stack/heap) and jumps to it.
  • Idea: memory is either writable or executable, never both — the "W X" policy.
  • How: the CPU's NX bit (No-eXecute, AMD) / XD bit (Intel) in the page table. Fetch from a non-exec page → fault.
  • Stack, heap, and data pages are marked non-executable; only .text and mapped libraries execute.
Key Takeaway

NX ends code injection. It does NOT stop reusing code that is already executable — that gap opens the door to ret2libc and ROP.