Fuzzing for Crashes
Find the offset.
Fuzzing for Crashes is a free Ethical Hacking Academy lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Ethical Hacking Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
What Is Fuzzing?
Fuzzing is sending malformed or oversized input to a program to trigger unexpected behavior, especially crashes. A crash often signals a memory corruption bug.
For buffer overflows, the first goal is to make the target crash so we know an overflow exists.
The Workflow
The classic exploitation workflow is:
- Fuzz to crash the program.
- Find the exact offset to the return address.
- Control EIP.
- Redirect to shellcode.
This lesson covers the first two steps.
Attaching a Debugger
To observe crashes, attach a debugger (such as Immunity Debugger or x64dbg on Windows, or GDB on Linux) to the target.
When the program crashes, the debugger shows the state of the registers, especially EIP, which reveals whether we overwrote the return address.
Sending Growing Input
A simple fuzzer sends increasingly large strings until the program crashes. A common starting point is sending many 'A' characters (0x41).
If EIP shows 41414141 after the crash, you have confirmed control over the return address.
python -c 'print("A"*2000)' | ./vulnConfirming the Crash
When the application crashes and EIP equals 41414141, the overflow reached the saved return address.
But you do not yet know exactly how many bytes precede EIP. Sending all the same byte tells you that EIP is controllable, not where it sits.
Finding the Offset: Cyclic Patterns
To find the precise offset, send a unique non-repeating pattern instead of all 'A's. Each 4-byte window is distinct, so the value that lands in EIP identifies the offset.
Metasploit ships pattern_create.rb for this.
msf-pattern_create -l 2000Reading the Offset
After crashing with the pattern, note the value in EIP. Feed it to pattern_offset.rb and it returns the exact number of bytes before EIP.
This offset is the size of your padding before the return-address bytes.
msf-pattern_offset -l 2000 -q 39654138Verifying the Offset
Always verify. Build an input of offset bytes of 'A' followed by four 'B' bytes (0x42). If EIP becomes 42424242, the offset is exact.
This confirmation prevents wasted hours debugging an off-by-a-few error later.
"A"*offset + "B"*4 # EIP should become 42424242Identifying ESP
After controlling EIP, you also note where ESP points at the moment of the crash. ESP usually points just after the overwritten return address, into your remaining buffer.
That space is where you will later place shellcode.
Tools Recap
Useful fuzzing and pattern tools include:
- Spike and boofuzz: network protocol fuzzers.
- pattern_create / pattern_offset: locate the EIP offset.
- mona.py in Immunity: automates pattern, offset, and bad-char tasks.
!mona pattern_create 2000Reproducibility Matters
A useful crash must be reproducible. Save the exact input that triggers it and re-run from a clean state to confirm the offset is stable.
Inconsistent crashes often mean the bug is not a clean stack overflow, or that some condition (timing, length, content) varies between runs.
Quick Check
Recall why a cyclic pattern beats a string of identical bytes.
Recap
You now know how to find the crash offset:
- Fuzz with growing input to trigger a crash; confirm with
41414141in EIP. - Use a cyclic pattern with
pattern_create/pattern_offsetto find the exact offset. - Verify with padding + four 'B' bytes (42424242).
- Note where ESP points for later shellcode placement.
Next you will fully control EIP and redirect execution.
Frequently asked questions
Is the “Fuzzing for Crashes” lesson free?
Yes — the full text of “Fuzzing for Crashes” is free to read here on the web, and the Ethical Hacking Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Ethical Hacking Academy course, upgrade to CoddyKit PRO.
What will I learn in “Fuzzing for Crashes”?
Find the offset. You practise Ethical Hacking Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Ethical Hacking Academy?
No prior experience is required. Ethical Hacking Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Fuzzing for Crashes” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Ethical Hacking Academy lesson?
Yes. Every Ethical Hacking Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Memory and the Stack
- Fuzzing for Crashes
- Controlling EIP
- Shellcode and Exploitation