Blog / A07:2021 Identification and Authentication Failures
A07:2021 · Identification and Authentication Failures

Trusting a Success Message You Never Asked For

A caller hands your state machine a transfer-succeeded report. Your code believes it, flips the verified flag, and fires the done callback. No transfer required.

caller invokespublic APIinjects a successreporthandler skipsstate checkverified flag setcompletioncallback firesATTACKER INPUTIMPACTtrust boundary crossed
Attack path · caller invokes public API → injects a success report → handler skips state check → verified flag set → completion callback fires

A caller hands your state machine a transfer-succeeded report. Your code believes it, flips the verified flag, and fires the done callback. No transfer required.

What goes wrong

The API takes any message a caller passes and routes it by type. One of those types is a status report saying a transfer went through. When the handler sees that report, it marks the exchange verified and calls the completion hook. It never checks what state the protocol was actually in, or whether a transfer was even in progress.

So a caller skips the work and sends the receipt. The handler treats an unsolicited report exactly like a real one produced at the end of a genuine exchange. There is also no binding to the peer that should have produced it, so a report from the wrong source counts just the same.

State machines get this wrong when the transition is driven by the message type instead of the current state. 'I received a success message' and 'the operation succeeded' are different claims. Only the second one should flip a verified flag.

The pattern

Vulnerable
function handle(msg) {
  switch (msg.type) {
    case SUCCESS_REPORT:
      transferVerified = true
      onResponseSent()          // fired regardless of state
      break
  }
}
Hardened
function handle(msg) {
  if (msg.type != SUCCESS_REPORT) return
  if (state != AWAITING_REPORT) { drop(msg); return }
  if (msg.sender != boundPeer) { drop(msg); return }
  if (msg.transferId != activeTransfer) { drop(msg); return }
  transferVerified = true
  state = DONE
  onResponseSent()
}
How the pipeline adjudicated itHELD
ABCDEFGH

Grounding and reachability were confirmed. The exploit-path gate would not conclude without the calling code, so the finding was held and an evidence request was raised instead of being reported as fact.

Ed25519 · per-tenant signing key · gate ledger A–H · verify offline against the published payload hash

Why it matters to you

A verified flag usually gates something real, like a payment marked settled or a session marked trusted. If an attacker can set that flag by sending a message, the guarantee behind it is gone. Any public entry point that mutates protocol state needs to check the current state before it acts, instead of trusting the shape of the input.

Check your own code