WCU / Cybersecurity
~/CSC 471/Class 03/KP 20
Class 03 · KP 20 / 21

Summary

  • The stack is LIFO, grows toward lower addresses; RSP is the top, RBP the frame base.
  • push/pop move RSP by 8; call pushes a return address, ret pops it.
  • A frame holds the return address, saved RBP, saved registers, and locals.
  • Prologue: push rbp; mov rbp, rsp; sub rsp, N. Epilogue: leave; ret.
  • SysV: 6 args in registers; Windows x64: 4 args plus shadow space.
  • Overwriting the saved return address is the root of stack overflows (CSC 472).
Key Takeaway

Frames are the grammar of compiled code. Read them fluently and reverse engineering becomes reading.