[STAGE-E] Exploit Feasibility Integration
You are bridging source-level validation with binary-level constraint analysis.
Context
See SKILL.md for configuration, execution rules, and MUST-GATEs.
Input
INPUT: findings.json (confirmed findings from Stage D)
Purpose
For memory corruption vulnerabilities, source-level validation alone is insufficient. A vulnerability can be:
- Real and reachable (validated by Stages A-D)
- But unexploitable due to binary/system mitigations
Stage E bridges this gap by invoking the exploit_feasibility package.
Applicability
Stage E applies ONLY to memory corruption vulnerability types. Do not decide this yourself — use the mechanical check:
from core.schema_constants import needs_feasibility_analysis
for finding in findings:
if needs_feasibility_analysis(finding["vuln_type"]):
# Run Stage E analysis
else:
finding["feasibility"] = {"status": "not_applicable"}The canonical set is MEMORY_CORRUPTION_TYPES in core/schema_constants.py. Do not maintain a separate list.
Prep (mechanical)
Validate Stage D output, discover binaries, and group findings:
libexec/raptor-validation-helper E "$OUTPUT_DIR" --target "$TARGET_PATH"This validates the previous stage, scans the target for executables matching source files, sets feasibility.binary_path on each finding, and groups them by binary. Non-memory-corruption findings are marked n/a.
IMPORTANT: You must pass --target so binary discovery can scan the target directory. If the output shows matched binaries, Stage E can run. If all findings show "skipped", there are no binaries to analyze — proceed to Stage F.
When discovery finds nothing, the prep attempts an env build-on-demand: authorised by the project build trust marker (or --build / --no-build explicitly), command from /project set build-command or detector synthesis, built in a container, analysed with feasibility.binary_provenance: "env-built". Pass --mitigation-matrix (same gate) to also rebuild hardened/soft posture variants and stamp each finding's feasibility.verdict_robustness. Both degrade to the skip with a printed reason — never treat a failed build as an error.
Task
[E-1] Locate Binary
For each applicable finding:
- Check if binary path is provided via
--binaryargument or in finding metadata - If not, attempt to locate automatically:
- Look for executables next to the source file (e.g.,
vuln.c→vulnor./vuln) - Check for executables matching the source filename without extension
- Look for Makefile/CMakeLists.txt to find build output
- Check common paths:
./build/,./bin/,./out/ - List the target directory for ELF executables:
find <target> -maxdepth 2 -executable -type f
- Look for executables next to the source file (e.g.,
- If multiple binaries found, group findings by which binary they belong to
- If no binary can be discovered, do not stop the pipeline to ask: follow “Handling Missing Binary” below (mark
confirmed_unverifiedand surface the build /--binary <path>re-run guidance in the report). Providing a binary is a run-boundary decision per CLAUDE.md § INTERACTIVE PROMPTS — an interactive session may offer the--binaryre-run at the completion fork; the non-interactive fallback is exactly the mark-and-continue above
{
"binary_search": {
"provided": "/path/to/binary",
"discovered": null,
"method": "user_provided|makefile|common_path"
}
}[E-2] Run Feasibility Analysis
For each binary group discovered by the prep script, run:
libexec/raptor-run-feasibility <binary_path> "$OUTPUT_DIR/findings.json" "$OUTPUT_DIR" --target "$TARGET_PATH"This runs analyze_binary once per binary, saves exploit context,
maps constraints to all findings referencing that binary, and updates
findings.json with feasibility verdicts and stage_e_summary.
Auto sink-watch (dynamic trust required). When attack paths name
watchable sink functions and findings carry a matched binary
(feasibility.binary_path, compiled artifacts only), the prep
script spawns the binary under a frida sink watch rendered from
attack-paths.json and folds the runtime evidence back into the
paths (runtime_evidence, callsite_match, proximity floor).
Gated on resolve_dynamic_validation — the same operator grant as
witness execution (--dynamic / --no-dynamic / project dynamic
trust marker); skipped with an explanatory line when not granted.
When a matched finding carries a string poc.payload, it is fed to
the spawned target on stdin, so input-gated sinks earn evidence
too; otherwise the target runs bare. Promote-only either way: a
sink firing earns evidence and silence changes nothing. Evidence is
scoped per binary — a watch run against one binary annotates only
the paths whose finding matched that binary, and its runs are
subtracted from the tree-wide evidence pool so a basename collision
cannot widen their reach — and launch freshness is
tracked in a helper-owned ledger (auto-sink-watch.json in the
workdir root, outside the watched process's write grant), so a
hostile target cannot forge run metadata to suppress future
evidence collection.
--target enables empirical mitigation analysis. When a witness
is discoverable for a finding (from this run's stores, or — when a
/project is active — from any sibling run's stores), the script
additionally rebuilds the target source under 4 mitigation profiles
(permissive / default-debian / hardened / asan-only), replays the
witness against each, and attaches feasibility.empirical_mitigation_map
to the finding. The full per-finding FeasibilityMap JSON lands at
<output_dir>/mitigation_feasibility/<finding_id>.json. No operator
action required — discovery + matching are mechanical; the empirical
step silently skips when source or witness is unavailable.
Stage E's per-finding verdict (Likely / Difficult / Unlikely) should
lift toward Confirmed when empirical_mitigation_map.summary.bug_fired_under
includes the profile matching the target's actual deployment, and
soften when it appears in blocked_under. The empirical evidence
is artefact-grade — strictly more trustworthy than the static
analyze_binary reasoning alone.
[E-2b] Cross-reference frida runtime evidence
If attack-paths.json contains runtime_evidence annotations for functions in this finding's flow, note them in feasibility.runtime_corroboration:
- Functions confirmed executing at runtime by frida strengthen the "reachable under deployment conditions" claim.
runtime_evidence.observed_args(when present) narrows input-constraint analysis — you know what arguments the function actually receives in practice.runtime_evidence.observed_callsites(when present) lists source-resolved call sites ({"module", "offset", "source": "file:line"});callsite_match: truemeans an observed call resolved onto this finding's own location — cite it as site-level, not just function-level, runtime corroboration.- Grade: annotations carry
receipt_stamp: "frida:runtime"/evidence_role: "detection"(shared evidence_grade vocabulary) — corroboration tier, so cite them as support for feasibility, never as a standalone exploitability verdict; absence of an annotation says nothing either way.
This is automatic context from Stage B; no manual invocation needed.
[E-3] Review Results
The feasibility script updates findings.json with per-finding verdicts. Review the output for each finding — the script prints the verdict and maps constraints to findings automatically.
[E-3b] Extract Key Constraints
From the analysis result, also note:
| Field | Description |
|---|---|
verdict |
likely, difficult, unlikely (snake_case in JSON — the VERDICT_MAP keys; Title Case is for human-readable report text only) |
protections |
PIE, NX, Canary, RELRO status |
glibc_version |
Detected glibc and its mitigations |
chain_breaks |
What techniques are blocked |
what_would_help |
Suggestions for success |
impact |
What attacker achieves: code_execution, dos, info_leak, etc. |
exploitation_paths |
Structured technique+target pairs |
one_gadget_info.smt_feasibility |
SMT constraint verdict (see below) |
SMT feasibility (CodeQL dataflow): For source-level dataflow findings, an SMT
pre-check runs in DataflowValidator before the full LLM analysis
(core/smt_solver/path_feasibility.py). The LLM extracts path conditions as
structured predicates; Z3 checks joint satisfiability:
feasible: true— path is reachable;modelcontains concrete variable values (candidate PoC inputs). These are injected into the LLM prompt and theDataflowValidation.prerequisitesfield.feasible: false— path conditions are mutually exclusive; finding is likely a false positive. Theunsatisfiedlist names the specific conflicting conditions (from the unsat core). LLM analysis is skipped entirely.feasible: null— Z3 unavailable or all conditions unparseable; full LLM analysis runs unchanged.
The reasoning string carries a mode tag in parentheses — e.g.
"feasible (32-bit unsigned): ...". This tells you the bitvector semantics
used for the verdict. If the tag's width doesn't match the vulnerability's
real C type, the verdict is suspect: a CWE-190 (integer overflow) path
analysed under 64-bit unsigned misses 32-bit wraparound and the false
verdict should be treated as incomplete — defer to your own C-semantics
reasoning rather than trusting it as a chain-break.
Best coverage: CWE-190 (integer overflow — Z3 finds wraparound bypass paths when the profile matches the real C type width), CWE-120/122 (buffer size arithmetic), CWE-193 (off-by-one), CWE-476 (null deref).
SMT feasibility (one-gadget): When the optional z3-solver package is installed, analysis.one_gadget_info.smt_feasibility contains a Z3-backed verdict on whether the best gadget's register/memory constraints can be satisfied:
feasible: true— constraints satisfiable; one-gadget is a viable target. Themodeldict shows what register values Z3 requires.feasible: false— constraints contradicted by crash state or mutually exclusive. Add the gadget's constraint list tochain_breaksand note it as "SMT: one-gadget constraints infeasible".feasible: null— Z3 returned unknown or constraints were unparseable; rely on the heuristicnotefield instead.
The heuristic note field is always preserved alongside smt_feasibility — compare both when they conflict. When smt_feasibility.feasible is false, prefer the SMT verdict for the chain_breaks entry.
[E-3 SMT] Choosing an SMT entry point
You have three SMT tools, listed in the order to reach for them:
| Situation | Tool | Why first |
|---|---|---|
The finding has an imported /understand flow trace with path_conditions (look in attack-paths.json for entries with source: "understand:trace" carrying that field) |
raptor-smt-validate-path --from-trace TRACE-ID --workdir "$OUTPUT_DIR" ([E-3c]) |
The trace's conditions were extracted alongside the dataflow walk with full source-code context — usually richer and more accurate than re-extracting from prose |
The source matches a named pattern: count * size or similar arithmetic-with-guard (CWE-190); arr[index] access (CWE-125 / CWE-787); pointer deref of a possibly-null pointer (CWE-476); chained malloc(count * size) + for i < count: buf[i] (CWE-680) |
Named verb: raptor-smt-check-overflow / -oob / -null-deref / -overflow-to-oob ([E-3d]) |
The verb's intrinsic predicate is right by construction (csem-built); you only have to extract operands and guards, not derive the encoding |
| Anything else — bespoke path conditions, multi-stage taint, mixed bitmask/relational guards, or a pattern none of the verbs cover | raptor-smt-validate-path with free-form predicates ([E-3c]) |
The general-purpose escape hatch; richer expressiveness at the cost of you constructing the predicate |
All three share Z3 availability, profile semantics, and unknown_reasons shape, so the iterate-on-rejection loop documented in [E-3c] applies uniformly. Do not call multiple tools for the same finding — pick one based on the table and trust the verdict (or its caveats) it returns.
[E-3c] Optional: SMT path-condition verification
When you've read the source for a finding and formed a hypothesis about whether the visible guards actually block exploitation — e.g. a CWE-190 where count < MAX_RECORDS looks protective but count * sizeof(record) might wrap on 32-bit unsigned arithmetic — you can ask Z3 to verify whether the path conditions are jointly satisfiable:
libexec/raptor-smt-validate-path --profile uint32 \
'alloc_size == count * 16' \
'alloc_size < 0x8000' \
'count > 0x10000000' \
'count < 0x40000000'Each positional argument is one predicate that must hold for the path to be reachable. If a guard is bypassed (must be FALSE on the dangerous path), pre-negate it manually: write ptr == NULL, not !(ptr != NULL).
Prefer pre-extracted conditions when available. If the finding has an imported attack path (look in attack-paths.json for entries with source: "understand:trace") carrying path_conditions and path_profile, use them via the --from-trace form — they were extracted by /understand --trace with full source-code context for that flow:
libexec/raptor-smt-validate-path --from-trace TRACE-001 --workdir "$OUTPUT_DIR"The script reads attack-paths.json itself, picks the matching trace, and applies its path_profile. You can override the profile with an explicit --profile <name> if the trace's choice doesn't match the vuln's real C type. Outcomes:
path_conditionsmissing /null→ script exits 2 with a clear message; fall back to extracting from source (positional args /--stdinform above).path_conditions: [](empty list) → script exits 0 withfeasible: trueandreasoning: "no conditions ...". The path is unconditionally reachable from the entry; no re-extraction needed.path_conditionsnon-empty → normal SMT verdict.
Tip — finding the exploit witness, not the trivial one: Z3 returns the smallest satisfying assignment by default, which is often count=0, length=0, etc. — mathematically correct but not the bug. Use --prefer-witness max:<var> (or min:<var>) to push Z3 toward an extremal value of the variable driving the bug. For the CWE-190 ALLOC pattern above, --prefer-witness max:count yields a wraparound-region witness directly — no manual lower-bound conditions needed. The legacy form of adding 'count > 0x10000000' still works and remains useful when constraining to a specific sub-range rather than pushing to the extreme.
--profile matches the C type width in play. Common choices:
uint32— Cint/unsigned intarithmetic (CWE-190 32-bit wraparound)uint64—size_t/uint64_t/ pointer arithmetic (default if omitted)int32— signedintwhere overflow UB matters- Also:
int64,uint16,int16,uint8,int8
Output is JSON to stdout:
feasible: true— the path is reachable;modelshows concrete witness values to use as PoC candidates.feasible: false— conditions are mutually exclusive; add tochain_breaksas "SMT: path infeasible" with theunsatisfiedlist as evidence.feasible: null— Z3 unavailable, conditions unparseable, or solver timeout; fall back to your own C-semantics reasoning.
When to use: CWE-190 (integer overflow / wraparound), CWE-120/122/787/125 (buffer-size arithmetic), CWE-193 (off-by-one), CWE-476 (null-deref guards) — anywhere "this guard looks protective, is it actually?" applies.
When to skip: if analyze_binary returned smt_available: false, z3-solver isn't installed and this tool would just return feasible: null — skip the call and rely on your own reasoning. Also skip when the finding already carries smt_feasibility from the CodeQL pre-check (don't redo work).
Conditions the parser rejects (these land in unknown and the verdict will lean toward null): type casts ((uint32_t)x), struct/pointer access (obj.field, s->len), array indexing (arr[0]), pointer deref (*p), unary NOT (~), XOR (^), division (/), modulo (%), ternary (?:), and non-call grouping parens ((a + b) * c). Stick to bare variables, integer/hex literals, NULL, and the operators + - * | & << >> plus relational < <= > >= == !=. If you have to express something more complex, simplify it first or omit it — a null verdict from a contaminated condition set is worse than no SMT call at all.
Function calls are recovered, not rejected — see the soundness warning below.
Profile mismatch is a silent failure mode. If you analyse unsigned int arithmetic under uint64, Z3 misses 32-bit wraparound and the feasible: false verdict you get is wrong (the path IS reachable via 32-bit wrap). Match the profile to the dominant C type's width. The reasoning string spells out what was used ("feasible (32-bit unsigned): ...") — if it doesn't match the vuln's real C type, treat the verdict as suspect.
Free-variable fallback over-approximates in the SAT direction. Function-call subterms (strlen(input), getpid(), min(a, b), ...) parse — the parser substitutes each balanced <ident>(...) with a fresh _anon_N Z3 free variable so the rest of the condition still drives feasibility. The catch: two textually-identical calls become independent free variables, because the parser doesn't know which calls are pure. So:
strlen(s) > 100 AND strlen(s) < 50returns feasible: true with a model like {_anon_0: 101, _anon_1: 49} — even though for any pure strlen the path is unsat (strlen(s) can't be both >100 and <50). The model is mathematically correct for the encoded problem but not for the real C path.
The asymmetry that matters for validation:
feasible: falsewith_anon_Nin the unsat core is still sound, with one check — adding free variables only relaxes constraints, so an unsat verdict can't become sat by removing them. The exception issummary:entries: background call-summary axioms are added assumptions, not relaxations. Assumption-tier axioms (sizeof(x) != 0— wrong for GNU C zero-size objects) are demoted by the solver itself: a refutation whose native core names one comes backfeasible: nullwith "background assumption" in the reasoning. Afeasible: falsethat still carries non-emptysummary_axiomstherefore leans on contract-tier axioms (strlen/wcslen nonnegativity, the strnlen bound, the abs INT_MIN corner, min/max ordering) or on a core that could not be extracted — confirmsummary_axiomsis empty andrefutation_uses_call_termsis nottrue; if either fires, verify each listed assumption against the source first.feasible: truewith_anon_Nkeys in the model is a hint, not proof — the actual path may be infeasible if the function calls are pure and the same call appears multiple times.
How to read it: scan model for keys starting with _anon_. If any are present:
- List the function calls in your conditions and ask "are these calls pure?" (most stdlib predicates are:
strlen,strcmp,strstr,getpid,htonl,min,max, …; non-pure:read,time,random, anything with side effects or external state). - If pure AND the same call appears more than once, the SMT verdict over-approximates. Re-issue the check with a helper variable that forces the calls to be the same value:
Now Z3 can prove the path infeasible (or genuinely sat) without the free-var escape hatch."len_s == 100" # was strlen(s) > 100, replace with the equality you actually need "len_s < 50" # same call, same variable - If pure but each call appears only once, the over-approximation is harmless — there's nothing for Z3 to conflate, and the verdict is as good as if you'd written a fresh symbol yourself.
- If non-pure, leave the
_anon_Nmodel alone — it's the correct encoding (the calls really do produce independent values).
In short: a feasible: true verdict on a path containing function calls is a necessary condition for reachability, not a sufficient one. Use it to keep the finding open, not to declare it exploited.
Iterate on unknown using unknown_reasons. When the verdict comes back with non-empty unknown, the parallel unknown_reasons array tells you exactly why each condition was dropped — read those rather than guessing. Each entry has the shape:
{
"text": "01234 < limit",
"kind": "literal_ambiguous",
"detail": "leading-zero decimal is ambiguous with C octal",
"hint": "rewrite as hex (0x...) or strip the leading zero"
}The kind values you'll see and the surgical fix for each:
kind |
What happened | Fix |
|---|---|---|
parens_not_supported |
Function call / cast / grouping parens | Replace the call with the predicate it computes, or introduce a helper var (n = strlen(input)) |
unrecognized_form |
No relational / bitmask shape at top level | Wrap in a relation, e.g. flag → flag != 0 |
unrecognized_operand |
Token isn't an ident / NULL / hex / dec literal | Look at detail for the offending token; rename or replace |
unsupported_operator |
Op outside `{+, -, *, | , >>, <<}` in the expression |
mixed_precedence |
Additive and multiplicative/bitwise mixed | Split into two conditions, each using one operator class |
trailing_tokens |
Tokens left unconsumed (e.g. a + b c) |
Insert the missing operator |
literal_ambiguous |
Leading-zero decimal — could be C octal | 01234 → 0x4d2 or 1234 |
literal_out_of_range |
Literal exceeds --profile width |
Switch to a wider profile, or check the literal is correct for the real C type |
lex_empty |
Tokeniser saw no tokens (empty / whitespace-only input) | Drop the condition — there's nothing to encode |
solver_timeout |
Z3 couldn't decide within the timeout | Simplify the conditions (drop redundant ones); don't keep retrying — the result is still null |
solver_unknown |
Z3 returned unknown for some other reason | Same — fall back to qualitative reasoning |
If the rejection's hint field is non-empty, prefer it over your own guess — the hint is written by the parser at the exact failure site and names the concrete fix. One targeted refinement pass usually closes the gap. If a second pass still has the same kind for the same text, stop iterating and fall back to qualitative reasoning — you're outside the bitvector fragment.
The verdict is only as trustworthy as the conditions you extract — a false verdict on an incomplete condition set is a hint, not proof.
[E-3d] Named SMT verbs — pattern-shaped helpers
Four pattern-named helpers cover the most common memory-corruption shapes: CWE-190 (overflow), CWE-125/787 (OOB), CWE-476 (null deref), and CWE-680 (chained overflow→OOB). Use them when the source matches the verb's pattern — they construct the right SMT predicate internally (built directly via core.smt_solver.csem — no parser round-trip for the verb's own predicate) so you don't have to derive the encoding from scratch.
Each verb returns the same JSON shape as raptor-smt-validate-path — feasible / model / reasoning / unknown_reasons etc. — so you read the result the same way.
Operand forms accepted: identifiers (count), numeric literals (16, 0x10), and balanced function-call shapes (strlen(input), sizeof(record), htonl(x)). Function calls go through the same free-variable fallback as validate_path (PR #244): each call becomes a fresh _anon_N Z3 variable. The over-approximation warning from [E-3c] carries through to verbs — when the verdict is feasible: true and the model contains _anon_N keys, treat it as a hint not proof: distinct calls become independent free variables, so the solver can satisfy the wrap predicate by picking any value for the anon var.
Compound expressions are rejected. a + b, s->len, *p, unbalanced parens — verb returns ValueError. For these, introduce a helper variable in --guard (e.g. --guard 'idx == offset + length' then pass idx as the operand) or use raptor-smt-validate-path directly. Caller-supplied guards can be compound (they go through the standard parser, which gets canonicalisation #241 + free-var fallback #244 transparently).
check_overflow — CWE-190 integer overflow / wraparound
When the source shows arithmetic with a guard that looks protective but the operand width could wrap (e.g. count * sizeof(record) under count < MAX_RECORDS where MAX is large enough that count * sizeof overflows uint32):
libexec/raptor-smt-check-overflow --op '*' \
--operand count --operand 16 \
--profile uint32 \
--kind unsigned_wrap \
--guard 'count > 0x10000000' \
--guard 'count < 0x40000000'--opis+,-, or*(csem provides overflow detectors for these binary ops).--operandis repeatable; pass each operand as a separate atomic identifier or literal. For 3+ operands, the predicate is "wrap occurs at SOME binary step in the chain", so intermediate wraps are detected even if the final result is in-range.--profilemust match the kind:unsigned_wraprequires unsigned (uint8/ … /uint64);signed_wraprequires signed (int8/ … /int64). Defaults touint32(most CWE-190 cases areint/unsigned int).--kind unsigned_wrap(default) usescsem.{u_add,u_mul}_overflowsfor+/*andcsem.usub_underflowsfor-.--kind signed_wrapusescsem.{s_add,s_mul}_overflows(covers both directions) for+/*only — signed-minus overflow shape is too narrow for this verb's binary template.--guardrepeats — one visible source-level guard each. Pre-negate bypassed guards.
feasible: true means overflow IS reachable under the guards; the model carries operand values that wrap.
check_oob — CWE-125 / CWE-787 array out-of-bounds
When the source shows arr[index] (or memcpy(buf, src, len) where len could exceed buf's size) and you want to verify whether the bounds checks actually exclude OOB:
libexec/raptor-smt-check-oob \
--buffer-size buf_size \
--index idx \
--profile uint64 \
--guard 'buf_size == 1024' \
--guard 'idx == offset + length' \
--guard 'offset + length <= buf_size'--buffer-sizeand--indexare identifiers naming the buffer length and the index used at the access site. Operands must be atomic — for a compound index likeoffset + length, introduce a helper variable and bind it in a guard (--index idx --guard 'idx == offset + length'), per [E-3d]. Guards themselves may be compound.--profiledefaults touint64(size_t-shaped). Override when the index isint/unsigned int.--guardrepeats; same conventions as above.
feasible: true means OOB IS reachable; the model shows the escaping index/buffer_size pair. Only checks the upper bound (index >= buffer_size); negative-index escapes need a signed profile and an explicit guard.
check_null_deref — CWE-476 null-pointer dereference
When the source dereferences a pointer that has prior nullness checks but the deref site might be reached through a path that skipped them:
libexec/raptor-smt-check-null-deref --ptr ptr \
--guard 'ptr == NULL' # the bypassed null-check, pre-negated--ptris the identifier at the deref site. Use the exact name as it appears at the deref —ptrandp->nextare distinct symbols to the parser.--profiledefaults touint64; override touint32for 32-bit targets.--guardrepeats. If a null-check was bypassed on the dangerous path, pass it pre-negated (--guard 'ptr == NULL', not--guard 'ptr != NULL') — the parser doesn't have a unary NOT.
feasible: true means the null deref IS reachable; feasible: false means a guard genuinely proves ptr cannot be NULL here.
check_overflow_to_oob — CWE-680 integer overflow → buffer overflow
When the source shows a CWE-680 chained pattern — integer wrap at allocation sizing causes an undersized buffer, then a subsequent indexed write/read goes past the wrap. Canonical example:
size_t alloc_size = count * element_size; // overflows on uint32
buf = malloc(alloc_size); // undersized due to wrap
for (i = 0; i < count; i++) buf[i] = ...; // OOB write past wrapPre-fix this needed running check_overflow AND check_oob and reconciling the two verdicts manually; this verb composes both predicates into one solver call.
libexec/raptor-smt-check-overflow-to-oob \
--count count \
--element-size 16 \
--index i \
--profile uint32 \
--guard 'count > 0'--count,--element-size,--indexare the three operands of the canonical pattern: count of elements at allocation, per-element size, and the index used at the write/read site. Same operand-form rules as the other verbs (identifiers, numeric literals, balanced function-call shapes).--profiledefaults touint32(most CWE-680 findings involve 32-bit unsigned arithmetic —size_ton 32-bit platforms orunsigned intoperand width). Override to match the C type ofalloc_size(the wrapped result).--guardrepeats; pass any visible bounds checks. A guard likecount < 0x1000will refute the pattern (no wrap reachable at that count); a guard likecount > 0excludes the degenerate empty-allocation case without preventing the wrap.
feasible: true means CWE-680 IS reachable; the model carries a concrete (count, i) pair satisfying both the wrap AND the OOB-write. feasible: false means the guards rule out either the wrap or the OOB.
When to use a verb vs raptor-smt-validate-path
- Use a verb when the source matches one of the four patterns above — the verb's predicate construction is right by construction, and the witness model is already shaped the way you'd want it for a PoC.
- Use
raptor-smt-validate-pathfor free-form path conditions that don't fit a pattern (e.g. multi-stage taint with mixed integer + bitmask + string-shape guards), or when iterating on conditions extracted from a/understandflow trace via--from-trace. - Verbs and
validate-pathshare Z3 availability, profile semantics, andunknown_reasonsbehaviour — the iterate-on-rejection loop from [E-3c] applies to verb results too.
[E-4] Update Finding
Attach feasibility analysis to finding:
{
"id": "FIND-001",
"vuln_type": "format_string",
"feasibility": {
"status": "analyzed",
"binary_path": "/path/to/binary",
"context_file": "/path/to/context.json",
"verdict": "difficult",
"protections": {
"PIE": true,
"NX": true,
"Canary": true,
"RELRO": "Full"
},
"glibc": {
"version": "2.38",
"hooks_removed": true,
"printf_n_blocked": true
},
"chain_breaks": [
"GOT overwrite blocked by Full RELRO",
"Format string %n blocked by glibc 2.38"
],
"what_would_help": [
"Run in older environment (glibc < 2.38)",
"Find info leak to defeat ASLR",
"Look for alternative write targets"
],
"impact": "code_execution",
"exploitation_paths": [
{"technique": "GOT overwrite via %n", "target": "GOT[exit] @ 0x28570"},
{"technique": "info leak via %p format specifiers", "target": "stack contents"}
]
}
}[E-5] Adjust Final Status
MANDATORY: After Stage E runs, update findings.json final_status for every applicable finding using this table. Do not leave final_status as the Stage D value — the Stage E verdict overrides it.
| Source Validation | Feasibility Verdict | Final Status |
|---|---|---|
| confirmed | exploitable | exploitable |
| confirmed | likely_exploitable | likely_exploitable |
| confirmed | difficult | confirmed_constrained |
| confirmed | unlikely | confirmed_blocked |
| confirmed | not_applicable | confirmed (unchanged) |
| confirmed | binary_not_found | confirmed_unverified |
This table is the canonical mapping and is pinned against the
mechanical VERDICT_MAP in libexec/raptor-validation-helper
(doc-code parity test) — likely_exploitable stays a DISTINCT final
status so operator-facing output preserves the proven-vs-probable
distinction; not_applicable applies no override (final status
unchanged).
Display rule: When rendering Stage E verdicts or final statuses into validation-report.md tables and prose, convert snake_case to Title Case (e.g. likely_exploitable → "Likely Exploitable", confirmed_constrained → "Confirmed Constrained"). JSON fields remain snake_case.
Output Format
{
"stage": "E",
"timestamp": "ISO timestamp",
"findings": [
{
"id": "FIND-001",
"source_validation": "confirmed",
"feasibility": { ... },
"final_status": "exploitable|likely_exploitable|confirmed_constrained|confirmed_blocked|confirmed|confirmed_unverified",
"recommendation": "Proceed with exploit development|Address constraints first|Focus on info leak only|Verify in different environment"
}
],
"summary": {
"total_confirmed": N,
"exploitable": N,
"constrained": N,
"blocked": N,
"not_applicable": N,
"unverified": N
}
}OUTPUT: stage-e.json
Handling Missing Binary
If binary cannot be located:
- Set
final_status: "confirmed_unverified"(the E-5binary_not_foundverdict row) - Write the feasibility record with
status: "skipped"and areason.binary_not_foundbelongs to the E-5 table's Feasibility Verdict column only — it is NOT afeasibility.statusvalue (enum:pending|analyzed|skipped|error|not_applicable). Omitbinary_pathentirely; never writebinary_path: null(string-when-present). The schema gate normalises both slips, but the canonical form is:{ "feasibility": { "status": "skipped", "reason": "Binary not found - feasibility analysis skipped" } } - Provide guidance:
To complete feasibility analysis: 1. Build the project: <detected build command> 2. Provide binary path: /validate --binary /path/to/binary 3. Or skip with: /validate --skip-feasibility
Handling Analysis Failures
If analyze_binary() fails:
- Log the error
- Mark finding as
confirmed_unverified - Include error in output:
{ "feasibility": { "status": "error", "error": "Failed to analyze: <error message>", "fallback": "Manual analysis recommended" } }
Integration with Exploit Development
Stage E output feeds directly into /exploit:
/exploit FIND-001
Reading finding FIND-001...
- Source validation: Confirmed
- Feasibility: Difficult
- Chain breaks: GOT blocked, %n blocked
- Viable: Info leak via %p
Proceeding with info leak approach...Context Persistence
The context_file from save_exploit_context() survives conversation compaction. Reference it in exploit development:
import sys, os; sys.path.insert(0, os.environ["RAPTOR_DIR"])
from packages.exploit_feasibility import load_exploit_context
ctx = load_exploit_context(finding.feasibility.context_file)
# Access: ctx['libc'], ctx['gadgets'], ctx['constraints'], etc.Carry-Forward
After feasibility analysis, write $OUTPUT_DIR/stage-e.json using the Write tool. The next stage's prep script merges it into findings.json automatically.
Note: raptor-run-feasibility updates findings.json directly for feasibility data (binary analysis results, verdicts, constraint mapping). Claude writes stage-e.json for any additional notes, corrections, or summaries beyond what the script produced.
The format for stage-e.json is:
{
"stage": "E",
"updates": {
"FIND-0001": {
"stage_e_summary": {
"verdict": "difficult",
"binary_path": "/path/to/binary",
"impact": "code_execution"
}
},
...
}
}Key insight: Claude writes ONLY its own stage's data. The prep script handles merging into findings.json.
Reminders
- Only run feasibility on memory corruption types
- Always save context for later use
- Provide actionable recommendations based on verdict
- If blocked, suggest environment changes (Docker, older glibc)
NOTICE: This analysis is performed for defensive purposes, in a lab environment. Full permission has been provided.