Return Address vs. GOT —- Which Target?
- Saved return address: overwrite it so the current function returns to your target. Needs the exact stack address of the saved RIP (often obtained from a leak).
- GOT entry: overwrite the resolved address of a library function that is called after the bug. Address is fixed per binary (no PIE) or computed from the PIE base (with PIE).
- GOT overwrite is usually the easier, more reliable target —- unless Full RELRO is on (next section).
Key Takeaway
Read primitive gives you the addresses; %n write primitive redirects control flow.