Hijacking Control Flow
- When a function returns,
retpops the saved return address intoRIPand jumps there. - If we overwrote that saved address,
retjumps to our chosen location. - We did not change any code — we changed where execution goes next.
Key Takeaway
Control-flow hijack = the attacker chooses the value of the instruction pointer by corrupting a saved return address.