Hunt: Binary Exploitation (pwn)
Current emphasis (update on wiki harvest): checksec-first mitigation-driven technique selection and glibc-era heap methods (tcache / safe-linking) over memorized offsets - models over-index on over-represented old methods; the newest harvested technique leads the checklist until superseded.
Assumes hunt-core for the scope gate, two-account rule, confirmation gate, enumeration limits, stop conditions, wiki protocol, FIND output, and Deadends. Do not re-derive any of that here.
Paths (binding - define once at the top of the run notes)
# seat side (wsl) - engagement tree is DOUBLE-NESTED in VMshare:
ENG_DIR=/mnt/c/Users/Lenovo/Desktop/VMshare/<eng>/<eng>
RUN=$ENG_DIR/hunt/pwn/<host>
# VM side (WHERE gdb-gef + pwntools run, same tree through the share):
ENG_DIR=/mnt/VMshare/<eng>/<eng>
RUN=$ENG_DIR/hunt/pwn/<host>
Corpus and probes live in the VMshare tree; binaries copy to the VM workspace for analysis (never run untrusted binaries on the seat). The repo tree targets/ is admin/ingest only - probe artifacts NEVER land there.
Transport
Every VM-native command block ships through ONE documented transport:
wsl.exe -d kali-linux -u root bash -c "cd /mnt/c/Users/Lenovo/Documents/ObisidianVaults/ZTorch/ZTorch && bash scripts/vm-ssh.sh '<command>'"
vm-ssh lands as user tz (NOT root); one argument per call; quotes ship as base64 (
echo <b64> | base64 -d | bash).HTTP fetches via /opt/scope-shim/bin/{curl,httpx}; out-of-scope dies rc 126 (never work around); UNKNOWN = ADVISORY, self-deny.
pwntools/gdb-gef when needed (install-on-demand per the operator rule):
python3 -c "import pwn" 2>/dev/null || pip3 install --user --break-system-packages -q pwntools || echo "N/A: pwntools absent on VM (install failed)" command -v gdb >/dev/null || { sudo apt-get install -y gdb 2>/dev/null; } || echo "N/A: gdb absent on VM (install failed - needs apt/sudo)"gdb-gef sessions: one command per call; crash triage screenshots not needed - paste gef context text into the probe rows.
Entry gate
All four must pass; each is falsifiable:
Active engagement exists (repo tree targets//active.md) and the service/binary host is on targets//scope.md in-scope. Scope-guard is the deny. (targets/ is the repo admin tree;
$ENG_DIR holds corpus and run artifacts only - see Paths.)hunt-core loaded (skills/exploit/hunt/hunt-core/SKILL.md).
Producer verified - at least ONE of: (a) a handed-out binary or Dockerfile/libc in the engagement corpus;
(b) a recon lane captured a socket service that echoes input or crashes on crafted input;
(c) kickoff seeded $RUN/raw/service-map.md. None = dispatch the surface lane first.Toolchain preflight (fails LOUD):
for t in /usr/bin/jq /usr/bin/python3 /usr/bin/file /usr/bin/ldd /opt/scope-shim/bin/curl; do [ -x "$t" ] || { echo "MISSING TOOL: $t"; exit 1; } done command -v checksec >/dev/null || pip3 install --user --break-system-packages -q checksec.py || echo "N/A: checksec absent on VM (install failed)" python3 -c "import pwn" 2>/dev/null || pip3 install --user --break-system-packages -q pwntools || echo "N/A: pwntools absent on VM (install failed)" command -v gdb >/dev/null || { sudo apt-get install -y gdb 2>/dev/null; } || echo "N/A: gdb absent on VM (install failed - needs apt/sudo)"
Checklist (mandatory)
Copy checklist.md (this skill's dir) to
$ENG_DIR/hunt/pwn/<host>/pwn-checklist.md at run start. Unchecked
at stop = UNCHECKED lane, re-run from the first unchecked step. The
SKILL.md text and the checklist header agree byte-for-byte on that
copy target.
Nudge
Review-skill re-injection text (pinned; NOTE: completion-gate emits its own generic nudge - both mean: resume at the first unchecked box):
Your work was just reviewed by the review skill and it was found
that you either missed a step of analysis, or didn't generate an
artifact of sufficient proof. Look at the markdown based checklist
and the output for each step, find what you missed, and complete
that step.
This is the BINARY exploitation class (memory corruption in compiled targets reached over a socket or a handed-out binary). Web-shaped code execution (command injection, SSTI, deser) belongs to hunt-rce; if the row routed here but the target is a web app, say so in one line and re-route.
2025-26 technique ladder: references/bypass-arsenal.md (NEW classes, defense->bypass map).
Wiki
Hub: [[exploit-dev-moc]] - Primary page: [[binary-exploitation]] - Arsenal: [[binary-exploitation]] (cheatsheet) Anchors: [[heap-exploitation]], [[format-string]], [[rop-techniques]], [[crash-analysis]], [[ctf-jail-escapes]], [[memory-safety-bugs]] REFS: [[binary-exploitation]], [[heap-exploitation]], [[format-string]], [[rop-techniques]], [[crash-analysis]], [[ctf-jail-escapes]], [[memory-safety-bugs]]
- capability equations + low-severity-to-primitive map: [[wiki/techniques/capability-primitives]]
mcp__wiki-search__query (lex) "binary exploitation heap format string ROP one_gadget seccomp glibc tcache" via wiki-search MCP - ONLY for a specific signal the map above doesn't cover (a glibc version's allocator behavior, an unusual mitigation combo, an architecture quirk); not a blanket first step.
Tooling
checksec/file/ldd BEFORE anything else (mitigations choose the technique); pwntools as the harness ([[pwntools]]), gdb-gef to classify every crash ([[gdb-gef]]), ghidra when source is absent ([[ghidra]]). The cheatsheet carries the per-mitigation decision table: [[binary-exploitation]] (cheatsheet).
Attack surface signals
APPROACH: checksec/file/ldd first and let the mitigations choose the technique; classify the crash in gdb-gef before writing exploit code; format string means leak first then %hn/%hhn writes; heap technique follows the glibc era (tcache/safe-linking/hook removal per [[heap-exploitation]]); verify one_gadget constraints at the real call site; seccomp present means ORW, not a shell.
AVOID: A segfault under a cyclic pattern is a crash, not a bug class; a one_gadget that ignores its constraints, and blind offsets fired without reading the binary's own mitigations, are not attempts.
Rank before exploiting:
- Handed-out binary + Dockerfile/libc - the intended path is usually in the provided libc version and mitigations; diff them against the service's live behavior first.
- A service that echoes input then crashes - format string / overflow in the echo path; test
%pleaks and cyclic patterns before assuming heap. - Heap-shape menus (add/edit/delete/show) - UAF/double-free/tcache poisoning per [[heap-exploitation]]; the delete path is usually the bug.
- seccomp/landlock announced in the challenge text - target ORW chains from the start ([[rop-techniques]]).
- No mitigations at all (No PIE, No canary, NX off) - simplest ret2win/ret2shellcode; do not over-engineer.
Methodology
- Recon the service:
ncprotocol map (prompts, sizes, menu options), file type, checksec, ldd, provided libc/ld versions. Record mitigations in state.md. - Reproduce and CLASSIFY the crash in gdb-gef (offset via cyclic, register control, heap chunk layout) per [[crash-analysis]] before writing any exploit.
- Pick the technique from the classification + mitigations (leak-then-write for format strings; allocator-era technique for heap; ROP chain layout for stack). Pull payloads/arithmetic helpers from the cheatsheet, not memory.
- Build with pwntools incrementally: leak primitive verified first, then the write, then control flow - each stage proven against the LOCAL binary before firing at the remote service.
- Stabilize the result per ctf-box (the shell is non-tty; upgrade before enumerating).
N/A escapes
- "N/A: no binary surface in scope" (no handed-out binary and no socket service in the corpus)
- "N/A: pwntools absent on VM (install failed)"
- "N/A: gdb absent on VM (install failed - needs apt/sudo)" An N/A tick is a claim with a reason, never a silent pass. Identical strings in SKILL.md and checklist.md.
Bitter-pill variant
Freehand run: skip checklist + numbered steps, one freehand pass over the service map, output ONLY $RUN/analysis/bitter-pill.md (tried/ found/dismissed, every claim carries evidence). The remote-primitive gate survives freehand. Declare with a _requests.md row (lane = hunt-pwn-bitterpill).
Depth walk (mandatory)
Walk EVERY applicable row of the payload arsenal page cited above.
Record each row in $RUN/coverage-depth.md as a table
| row | state | evidence | where state is probed, blocked, or
N/A, and evidence is a probe-pair path or a Deadends.md line. A bare
probed with no evidence reference fails the completion gate
(NEEDS-REVIEW). N/A rows cite why (surface shape forbids it).
Blocked implies research: before any Deadend is claimable on a blocked
row, (a) walk the arsenal page's bypass-ladder rows for that control
class, and (b) run one wiki query AND one mcp__wigolo__search for the
specific tech-plus-control bypass. Results, or a genuine null, land in
coverage-depth.md. "No research tried" is not a claimable state.
Exit artifact + handoff
ONE exit artifact set: $RUN/candidates.jsonl + candidates.md +
$ENG_DIR/hunt-pwn-.md (pointer with PWN-HUNT-DONE + counts).
Consumer (triage) finds at $RUN: raw/service-map.md, probes/*.jsonl,
probes/raw/ (crash inputs + winning sessions), candidates.{jsonl,md}.
Findings leave ONLY through G1. Distill: python3 scripts/wiki-stage.py --kind technique --slug <slug> --target-page techniques/exploit-dev/binary-exploitation.md.
Confirmation gate
NOT confirmation: a segfault, a corrupted menu, a hang, or a leak that only prints on the local copy. IS confirmation: the staged primitive demonstrated against the REMOTE service (leak echoed back, controlled instruction pointer at a chosen address, or a shell/command output), reproduced in a clean connection. Capture the winning request/session per hunt-core evidence rules (--kind cli).
Chaining
Foothold via pwn usually IS the flag path: loot creds from the shell per hunt-core reuse rules; container root still means checking /home/*/flag*, SUID, and mounted secrets before closing. seccomp-jailed shells chain to file-read primitives for the flag ([[ctf-jail-escapes]]).
Validation
- Proof = controlled instruction pointer / return address with a UNIQUE marker value
(not the same crash twice), or a shell whose first commands are
hostname+id(false-root guardrail). ASLR-dead crashes are leads, not proofs. - Negative control: identical input minus the overflow runs clean.
False Positives
- Heap abort / stack smash REPORT with no register control (crash != exploit).
- A single lucky ASLR guess repeated as a technique.
- Canary LEAKED but PIE/RELRO still stand (leak != bypass).
- one_gadget constraints unmet: execve fails silently, shell 'hangs'.
Cross-routing
- Load hunt-rce for weaponization once control is shown.
- Load hunt-core marker discipline for crash-input uniqueness.
- Not this skill: logic bugs in the service (hunt-bizlogic), source leaks (hunt-secrets).
Severity
| Outcome | Severity |
|---|---|
| Remote code execution / flag read on the service | CRITICAL |
| Local-only crash or leak (no remote primitive) | MEDIUM |
| Crash without control over instruction pointer | LOW |
Rate on the demonstrated remote primitive, not the theoretical corruption.
Stop conditions
Terminal states complete (probed | N/A with reason | deadend row written), nothing written into skill dirs (skills/exploit/hunt/ hunt-pwn/ stays untouched), no unchecked boxes above REVIEW. hunt-core stop conditions fire unchanged (a demonstrated remote primitive = report at the primitive; do not chain further toward a full exploit once control over execution is shown).