WCU / Cybersecurity
~/CSC 472/Class 07/KP 02
Class 07 · KP 02 / 18

Code Reuse: The Big Idea

  • The binary and shared libraries (libc, ld) are mapped r-x: readable and executable.
  • We still control the return address via a stack overflow.
  • Instead of pointing ret at our data, we point it at code that already exists.
  • Two flavors, increasing in power:
  • ret2libc: return straight into a useful libc function (e.g. system).
  • ROP: chain many tiny snippets ("gadgets") to compute almost anything.
Key Takeaway

NX stops injected code, not borrowed code. Control of the return address is control of execution.