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

The action runs first, the prompt is the catch block

This flow does the protected work first and only shows a biometric prompt if the attempt happens to throw. When nothing throws, nobody is asked anything.

caller invokesprotected actionaction tried witha fresh handleprompt only onthe…no exceptionmeans no authATTACKER INPUTIMPACTcheck absent
Attack path · caller invokes protected action → action tried with a fresh handle → prompt only on the right exception → no exception means no auth

This flow does the protected work first and only shows a biometric prompt if the attempt happens to throw. When nothing throws, nobody is asked anything.

What goes wrong

The control flow is backwards. The protected action is attempted immediately, using a freshly created handle, before any prompt appears. Authentication is wired up as the exception path: if the operation throws the specific error an auth-required key raises, only then does the biometric prompt come up.

That makes the whole guarantee depend on the key throwing. If the key was configured without the authentication requirement, or the operation does not exercise the key in a way that triggers the check, nothing throws and the action just completes. Auth-by-exception fails open by design. The happy path is the bypass.

The pattern

Vulnerable
function runProtected(action) {
  try {
    action(newCryptoHandle())        // runs before any prompt
  } catch (e) {
    if (isAuthChallenge(e)) showPromptThen(action)  // auth only here
    else throw e
  }
}
Hardened
function runProtected(action) {
  showAuthPrompt({
    onSuccess: result => action(result.cryptoHandle),  // bound handle
    onFailure: () => deny()
  })
  // never attempt the action before the prompt resolves
}
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

Fail-open authentication is the worst kind, because everything looks fine in testing. The demo works, the prompt shows up when the key is configured the way the developer expected, and the one misconfigured key or exception-free operation quietly skips it in production.

Authentication should gate the action, not clean up after it. Show the prompt, wait for a bound success, then act. If the order is reversed, assume the check can be skipped.

Check your own code