Exploit recipes
Find the primitive first, then open the matching recipe. All scripts below target a local, intentionally vulnerable challenge binary; replace prompts, offsets, addresses, and libraries with values from your build.
| What you control | Recipe |
|---|---|
| A neighboring variable, but not the return address | Memory overwrite |
| The saved return address and an existing success function | Ret2win |
| Return address plus gadgets to set registers or chain calls | ROP |
| A function leak plus a matching libc | Ret2libc |
Input passed as a printf format string |
Format string |
Saved stack state or an epilogue changes ESP |
Stack pivot |
Fast workflow
Section titled “Fast workflow”- Identify the write or control-flow primitive in Ghidra.
- Measure the actual offset and inspect changed memory in GDB/pwndbg.
- Check PIE, NX, canary, and RELRO for the exact binary.
- Build the smallest local pwntools payload that proves the idea.
- Re-run from a fresh process and verify the success condition.
For off-by-one writes, integer-size bugs, and use-after-free, start with the same evidence loop: identify the affected object or value, measure the boundary, and confirm the runtime effect before choosing a technique.