The call / ret Mechanism
call targetdoes two things atomically:
push rip_of_next_instruction ; save return address
jmp target ; transfer control
retreverses it:
pop rip ; take return address off the stack, jump back
- The return address is the single most important value on the stack for exploitation.
- If an attacker overwrites it,
retjumps wherever they choose.
Key Takeaway
call pushes; ret pops. Control flow lives on the stack.