Tech Forge

Exercises › Module 06

Offset Trap

An AI-assisted exercise on buffer-overflow methodology, memory protections, and writing an honest finding. Suggested time: about 40 minutes.

Goal

Use an AI assistant to generate a fictional penetration-test case file (lab notes from a junior tester, a debugger appendix, and a draft client finding about a buffer overflow), then turn it into a finding ready for the client. You review documents, not exploits: no payloads are built, no services are attacked, and no shellcode appears. Your real job is to catch what the draft finding got wrong before it ships.

Safety rules

1 Generate the case file

Paste this into your AI assistant. It builds three fictional documents. Save the output before moving on.

You are helping me build a fictional training case for an ethical hacking class. Everything must be invented. Do not output exploit code, shellcode, msfvenom commands, payloads, working scripts, or real crash dumps. The client is 'Northwind Harbor Authority', a fictional port operator. The testers are 'Cedarline Security', a fictional penetration-testing firm. The lab service under test is nicknamed 'DockSync' and exposes a function called TRUN on 203.0.113.20:9999. Use only .example domains and documentation IP addresses (192.0.2.x, 198.51.100.x, 203.0.113.x). No real companies, people, CVEs tied to real products, or live targets.

Create a buffer-overflow methodology case file with three documents:

Document A, Junior Tester Lab Notes: a first-person walkthrough claiming the tester spiked functions, fuzzed TRUN, found an EIP offset, overwrote EIP with BBBB, checked bad characters, picked a JMP ESP module, and 'got a shell.' Write it as confident notes, not as a tutorial. Include claimed numbers: fuzz crash around 9400 bytes, claimed EIP offset of 2000 bytes, claimed only bad character is null (0x00), claimed JMP ESP at 0x625011AF in essfunc.dll, claimed reverse shell to 198.51.100.50:4444.

Document B, Debugger Appendix: a short appendix that looks like pasted debugger observations (NOT real dumps). It must include: (1) a cyclic-pattern EIP value of 386F4337 with a note that a pattern-offset tool decoded that value to byte 2003; (2) an ESP byte dump summary stating that bytes 0x00, 0x0A, and 0x0D did not appear in order / were corrupted, while other bytes looked intact; (3) a module inventory line showing essfunc.dll with ASLR=Yes, Rebase=Yes, SafeSEH=No, NX=Yes (so it is NOT a safe return module). Keep this factual and dry.

Document C, Draft Client Finding: a one-page finding written for the Harbor Authority CISO with title, severity (Critical), affected asset (DockSync TRUN on 203.0.113.20), technical summary that trusts Document A's numbers, evidence bullets, and remediation. The remediation section must incorrectly tell the client to 'temporarily disable Address Space Layout Randomization (ASLR) and Data Execution Prevention (DEP) on DockSync hosts to stop overflows from being exploitable,' and must omit input validation, safe memory functions, stack canaries, and keeping ASLR/DEP enabled.

IMPORTANT: do not label, flag, or hint at these anywhere, and write them as normal details:
- Document A claims offset 2000; Document B's pattern decode is 2003. Document C uses 2000.
- Document A claims only 0x00 is bad; Document B shows 0x00, 0x0A, and 0x0D corrupted. Document C repeats 'only null.'
- Document A/C praise essfunc.dll 0x625011AF as a safe JMP ESP; Document B shows that module has ASLR and NX enabled.
- Document C's remediation disables ASLR/DEP instead of keeping them and fixing the code.
- Everything else should read as a plausible (but flawed) junior write-up.

Tip: if the AI labels or flags any planted problem, ask it to regenerate without flags, or swap case files with a partner.

2 Have AI write the client-ready finding

Ask the AI to turn the case file into a finding for the client.

Act as a senior penetration tester at Cedarline Security. Using only Documents A, B, and C, write a client-ready finding for the Northwind Harbor Authority CISO with these sections:
1) Title and severity.
2) Affected asset and function.
3) Technical summary of the buffer-overflow methodology (spike, fuzz, offset, EIP control, bad characters, return module, impact) in plain language — no exploit code.
4) Evidence table: claim, source document, and confidence.
5) Business impact in two sentences.
6) Remediation recommendations (developer and system hardening).
7) Retest criteria.

Then rate your confidence in the overall finding (High, Medium, or Low) and explain why.

Watch the offset, the bad-character list, the module protections, and the remediation. The AI tends to trust the junior notes and the draft finding.

3 Review it yourself, then fix it

Do this review yourself before you trust the AI's finding:

  1. Compare the claimed EIP offset in Document A with the pattern-offset result in Document B. Do they match? What happens to every later step if the offset is wrong?
  2. Compare the bad-character claim with the ESP dump summary. Which bytes are actually unsafe for this protocol path?
  3. Read the module inventory. Does the chosen JMP ESP module really have ASLR / NX / Rebase disabled? What does using a protected module do to reliability?
  4. Read the remediation. Does it strengthen memory protections or weaken them? What should a correct remediation say instead (input validation, safe APIs, stack canaries, keep ASLR and DEP on)?
  5. Stretch goal: for each problem, name the Module 06 pipeline step or defender control that would catch it.

Then fill in the brackets and run:

Revise the Northwind Harbor Authority finding:
1) The EIP offset in the junior notes is [claimed offset] but the debugger appendix decodes the cyclic pattern to [correct offset]. State that EIP control was not proven at the claimed offset, mark shell/impact claims as unverified, and require the offset step to be redone before any payload work.
2) Bad characters are not 'only null.' The appendix shows [list the corrupted bytes]. Update the evidence and note that any payload must avoid those bytes — without providing payload bytes.
3) The chosen module [name] shows [ASLR/NX/Rebase status] in the appendix, so it is not a safe return module under those protections. Remove the claim that a reliable JMP ESP was found; recommend confirming a module with protections disabled only in the authorized lab, and emphasize production hardening instead.
4) Replace the remediation that disables ASLR and DEP with: validate input length and content before copies; replace unsafe functions (gets/strcpy/sprintf); enable stack canaries and compiler hardening; keep Address Space Layout Randomization (ASLR) and Data Execution Prevention (DEP) / No-eXecute (NX) enabled; retest after the code fix.
5) Update the confidence rating and explain what changed.

Re-read the revision. The AI sometimes fixes the evidence table but leaves the wrong offset or the 'disable ASLR' line in the summary.

Review checklist

Deliverables

Grading rubric (10 pts)

CriterionPts
Offset mismatch caught, with impact on later steps explained2
Bad-character list corrected from the appendix (not 'only null')2
Protected module rejected as an unsafe/unreliable return address2
Remediation fixed: keep ASLR/DEP, add validation / safe APIs / canaries2
Corrected finding is consistent end to end (summary, evidence, retest, confidence)2
Answer key (spoilers: finish the exercise first)

What a correct submission shows

Why it matters

Common mistakes

Instructor variant (same answer for everyone)

Add this line to the Step 1 prompt:

Make Document A claim offset 2000 and 'only 0x00'. Make Document B decode 386F4337 to 2003 and list corrupted bytes 0x00, 0x0A, 0x0D. Set essfunc.dll ASLR=Yes, NX=Yes, Rebase=Yes. Keep the bad remediation that disables ASLR and DEP.

Answer: offset 2000 vs 2003; bad chars 0x00/0x0A/0x0D; essfunc.dll not safe; remediation must keep ASLR/DEP and fix input handling.

Join the Tech Forge community

Share your corrected finding, compare which problems you caught, and get feedback from other learners on the Tech Forge Discord.

Join the Discord

Or scan the code with your phone: techforge.community/discord

QR code linking to techforge.community/discord