REFERENCE GUIDE
Stack overflows and precise overwrite offsets
A stack overflow writes beyond a local object into adjacent stack state.
Also known as: stack buffer overflow
Mechanism
A stack overflow writes beyond a local object into adjacent stack state. The useful target may be a return address, saved frame pointer, canary, argument, or nearby application variable. Layout depends on the compiler, optimization, ABI, and input operation. Counting source-level array bytes rarely establishes the actual distance to a target.
Practical method
Find the input boundary and reproduce a crash with a distinctive pattern. Inspect the faulting instruction and stack bytes before calculating an offset. Replace the pattern with a short structured fixture that changes only the intended target. Confirm truncation, newline handling, and terminating null writes.
[local buffer][padding][canary?][saved frame][return address]
offsets come from the compiled frame
Interpreting evidence
A fault while dereferencing a corrupted pointer is different from control over the instruction pointer. Record which register or stack slot contains your bytes and whether the corrupted value is used before returning.
Pitfalls and limits
A partial pointer overwrite can preserve unknown high address bytes but still depend on alignment. Canary checks occur before normal return. Compiler-added padding makes source-level dimensions unreliable.