Blog

How FinLexPurple decides a vulnerability is real: deterministic replay, not model confidence

FinLexPurple is a local, open-source security agent for financial applications. This post is about the one design decision the whole tool is built around: a finding is only called verified when code re-executes it and reproduces the effect — never because a model is confident.

First, the limitations

Before the pitch, the bounds — because a tool that tests payment logic has no business overselling itself.

FinLexPurple is pre-1.0. The data contract and the evidence-bundle format are frozen, but surfaces and flags are still moving. Not every vulnerability class can reach verified yet: some are detected and reported for a human, with no replay engine behind them. And at least one class that does have a replay — race conditions — is inherently timing-dependent, so its verification is best-effort and will often land on inconclusive rather than verified. That is by design: the tool would rather tell you “I couldn't prove this” than round a maybe up to a yes. The honest, per-class status table is near the end of this post.

With that said, here is the idea.

The problem with “AI-confidence” findings

The common shape of an AI security tool is: a model looks at an app, decides something is probably a vulnerability, and writes it up with a confidence score. The trouble is that the confidence is the model's opinion about its own output. It is not evidence. A reflected string that looks like it executed, a parameter that might be an IDOR, a webhook that appears to accept a forged event — the model can be wrong about all of these, and when it is, you don't find out until a human has re-triaged the report by hand. For a team, that re-triage is the actual cost of “AI pentesting”: the tool shifts work rather than removing it, and a false “critical” on a payment path is worse than silence.

FinLexPurple starts from the opposite rule: the model may propose, but only code may confirm. A language model can plan a scan, choose what to probe, and draft an exploit. It is never consulted to decide whether the exploit worked.

The status model: one function, one route to “verified”

Every finding carries a status, and the status is produced in exactly one place. Here is that function (docstring omitted), from finlexpurple/verifier/status.py:

def status_for(result: ReplayResult) -> FindingStatus:
    if result.outcome is not None:
        return _OUTCOME_STATUS[result.outcome]
    if result.reproduced is True:
        return FindingStatus.VERIFIED
    return FindingStatus.REPORTED

A ReplayResult is what a replay engine returns after it re-executes a finding. It carries a structured ReplayOutcome, and the mapping to a status is this — the only mapping in the system:

_OUTCOME_STATUS = {
    ReplayOutcome.REPRODUCED:     FindingStatus.VERIFIED,
    ReplayOutcome.NOT_REPRODUCED: FindingStatus.NOT_REPRODUCED,
    ReplayOutcome.INCONCLUSIVE:   FindingStatus.INCONCLUSIVE,
    ReplayOutcome.BLOCKED:        FindingStatus.BLOCKED,
    ReplayOutcome.NO_ENGINE:      FindingStatus.REPORTED,
}

Read it and the guarantee falls out: **verified is reachable from exactly one input — ReplayOutcome.REPRODUCED** — and that outcome is only ever returned by a replay engine that re-ran the exploit and confirmed its durable effect. There is no branch from a model's confidence to verified. The module's own docstring says it plainly: “There is deliberately no path from an LLM's opinion to verified.” The source file imports no model client at all.

The other outcomes are not failures of the tool; they are the tool being precise about what it saw:

  • NOT_REPRODUCED — the exploit re-executed and the effect did not occur (the server rejected it, or durable state shows it wasn't persisted). This is not “the vulnerability is absent” — it's “this run didn't reproduce it.”
  • INCONCLUSIVE — it re-executed but the durable impact couldn't be confirmed (nothing to read the result back from).
  • BLOCKED — a state-changing re-execution wasn't permitted by the approval gate, so nothing was sent.
  • NO_ENGINE — there's no replay for this class; it stays reported for a human.
Coming soon

Recording of a real scan

A terminal recording of a real scan producing a mix of verified and reported findings, so you can watch the status model at work. Until it is published, the transcript on the homepage shows a real run's output.

Placeholder for a recording of a real scan.

A concrete walk-through: payment webhook signature bypass

Abstract guarantees are cheap. Here is one real class end to end.

A payment webhook is the callback a provider sends your app to say “this order is paid.” If your endpoint trusts the event body without verifying the signature, an attacker can forge a “paid” callback for an order nobody paid for. It's a classic, high-impact business-logic flaw — and a perfect test of the verification philosophy, because “the endpoint returned 200” is not proof the money state changed.

Step 1 — the forged callback (the detector)

FinLexPurple sends a deliberately invalid, clearly-labelled probe. The constants are fixed and auditable, from finance/payment_tests/webhook_bypass.py:

FORGED_ORDER_ID = "flp-webhook-probe-0001"
PAID_MARKER     = "paid"

# forged body
{"event": "payment_intent.succeeded", "order_id": FORGED_ORDER_ID,
 "status": PAID_MARKER, "amount": "0.00"}

# forged headers — the signature is openly fake
{"Content-Type": "application/json", "X-Signature": "invalid-not-a-real-hmac"}

Nothing here is subtle or hidden: the order id is a sentinel, the signature literally says invalid-not-a-real-hmac. A correctly-implemented endpoint must reject it.

Step 2 — the gate (before anything is re-sent)

Re-sending a forged payment callback changes state, so the replay cannot run until the approval gate allows it. From verifier/replay/webhook_bypass_replay.py:

outcome = gate.resolve(GateAction(
    description=f"re-send forged webhook callback to {finding.url}",
    category=category,
    state_changing=True,
))
if outcome not in _PROCEED:
    return ReplayResult(
        None,
        "not replayed: approval not granted for a state-changing re-execution "
        f"(gate outcome: {outcome.value}); replay blocked.",
        outcome=ReplayOutcome.BLOCKED,
    )

If approval isn't granted, the outcome is BLOCKED and nothing is sent. The gate category is derived from the finding's own agent, and the sensitive financial categories are hard-gated — they can't be waved through by configuration.

Step 3 — the independent oracle (the part that matters)

Say the forged callback is accepted (HTTP 2xx). A lesser tool would call that “verified” and move on. FinLexPurple does not — acceptance of an unsigned callback is not proof the order is durably paid. It requires a separate, independent read-back: did the order actually flip to paid, observed from somewhere other than the endpoint we just poked?

That read-back is the settlement oracle, and it reads from an operator-provided order-status URL (--order-status-url / FLP_ORDER_STATUS_URL), never by re-reading the webhook endpoint. From verifier/read_back.py:

def confirm(finding) -> bool | None:
    if not order_status_url:
        return None
    url = order_status_url.replace("{order_id}", webhook_bypass.FORGED_ORDER_ID)
    # ... GET the order-status oracle ...
    return webhook_bypass.PAID_MARKER in text and webhook_bypass.FORGED_ORDER_ID in text

The comment in that file is the whole thesis in one line: “A paid signal is never synthesized.” The tool doesn't compute “paid” itself and it doesn't trust a flag the target hands back — it goes to an independent source of truth and checks whether the forged order is genuinely marked paid there.

Step 4 — the verdict

Now the replay's branches map cleanly onto reality (verbatim from the replay, with the ReplayOutcome each returns):

What actually happenedLog line (real)Outcome
Server rejected the forged callbackre-sent forged callback; server rejected it (HTTP <status>) — signature validated / replay refused — not reproduced.NOT_REPRODUCED
Accepted, but no oracle to checkforged callback accepted (HTTP 2xx) but no in-scope read-back was available to confirm the order flipped to paid — inconclusive.INCONCLUSIVE
Accepted and oracle shows it durably paidforged callback accepted and the order is durably marked paid in in-scope state — exploit reproduced.REPRODUCED → verified
Accepted, oracle shows not paidforged callback accepted but the in-scope read-back shows the order was not marked paid — not reproduced.NOT_REPRODUCED

Only the third row produces verified. A forged, unsigned “paid” event that the server accepts but that never actually marks the order paid is not a win — it's inconclusive or not_reproduced, and FinLexPurple labels it that way. That is the difference between “the endpoint answered 200” and “an attacker can mark orders paid for free,” and it's the difference the whole tool exists to draw.

The evidence bundle, and re-checking it offline

A verified finding that you still have to take on faith isn't much better than a confident guess. So every verified finding is written as an evidence bundle: a canonical record (a DSSE-wrapped in-toto statement, bundle_format: flp-bundle/v1) addressed by a content hash. When signing material is available the bundle is signed keyless (Sigstore/cosign); when it isn't, FinLexPurple falls back to a hash-only bundle and says so, rather than implying a signature it doesn't have.

The point is that you can re-check it, with no scan and no network:

$ finlexpurple verify-bundle sample.bundle.json
  payload digest matches (sha256:7e08a3df5c194ad56b66630523be6cc3583fdb66a9b4ef8c275fa7103f77b4bf); hashed over the exact stored bytes.
  no signature to verify (signing mode: hash-only); integrity rests on the payload digest.
OK: bundle verified.

That output is real — it's the shipped verify-bundle command run against the bundle you can download below. It recomputes the canonical content hash over the exact stored bytes and confirms nothing was altered. A reviewer, a CI pipeline, or a maintainer on the other end of a report can confirm the finding independently, without trusting FinLexPurple at all.

What's verified vs reported today (honest status)

Replay-backed means a verification engine exists and will promote a finding to verified when it reproduces the effect against an independent read-back. It does not mean always-verified — when the effect can't be reproduced, the finding stays reported or inconclusive. Reported-only means there's no replay engine; the class is surfaced for a human and never auto-verified.

Web classes (run end-to-end in scan):

ClassVerification
SQL injectionReplay-backed
Reflected XSSReplay-backed (headless browser)
IDORReplay-backed (cross-session)
SSRFReplay-backed (out-of-band canary)
Cache poisoningReplay-backed
Security misconfigurationReported-only
Auth misconfigurationReported-only

Financial / business-logic classes (run through the gated financial agent):

ClassVerification
Price tamperingReplay-backed (gated)
Webhook signature bypassReplay-backed (gated)
Order IDORReplay-backed (cross-session)
Coupon / discount abuseReplay-backed (gated)
Payment-status trustReplay-backed (gated)
Refund abuseReplay-backed (gated)
Race condition (double-processing)Replay-backed (gated); verification is best-effort, often inconclusive

If a class isn't in these tables with a replay, assume it's reported-only for now. The README carries the current version of this table as classes gain replays.

Why this is the right default for financial testing

On a payment path, a false positive wastes an engineer's afternoon and a false sense of security costs real money. A tool that says “verified” should mean it. FinLexPurple's answer is to make “verified” a mechanical fact — one function, one outcome, an independent read-back, and a bundle you can re-check yourself — and to be plainly honest about everything it can only report. The model gets to be clever. The code gets to decide.

FinLexPurple is open source under Apache-2.0 and pip install finlexpurple away. It's early, and feedback — especially on where the approach breaks down — is exactly what I'm looking for.

— Muhammad Ibrahim