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

A caller flag decides if your key needs a face

Whether a new key demands user authentication is set by a boolean the caller passes. Send false and the key lands in the keystore with no auth binding at all.

caller sets theauth-required…flag passedstraight throughfalse skips theauth constraintunprotected keystored…ATTACKER INPUTIMPACTcheck absent
Attack path · caller sets the auth-required flag → flag passed straight through → false skips the auth constraint → unprotected key stored in keystore

Whether a new key demands user authentication is set by a boolean the caller passes. Send false and the key lands in the keystore with no auth binding at all.

What goes wrong

The most important security decision about a key is made in one line, and this code lets the caller make it. A key's security properties are locked in the moment it is created, and one of the biggest is whether using it demands user authentication. Here that decision is delegated to the caller through a boolean parameter. Pass true and the key is gated by biometric or device credential. Pass false and it is not.

Once a key is generated without the authentication requirement, it stays that way for its whole life. Anything that can reach the key can use it, no prompt, no re-auth. If any path lets an attacker or a careless caller choose false, the sensitive operations that key protects are available without the user ever being asked. A security property this important should not be a parameter.

The pattern

Vulnerable
function generateKey(alias, requireAuth) {
  const spec = keySpec(alias)
  // requireAuth comes straight from the caller
  spec.setAuthRequired(requireAuth)
  keystore.generate(spec)             // false leaves the key ungated
}
Hardened
function generateKey(alias) {
  const spec = keySpec(alias)
  spec.setAuthRequired(true)          // fixed policy, not an argument
  spec.setAuthValidityWindow(SHORT)   // re-auth per use
  keystore.generate(spec)
}
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

Keys outlive the request that made them. A key born without an authentication requirement is a standing liability no later check can fully repair, because the constraint has to be baked in at creation. When the constraint is optional, someone eventually ships the option that turns it off.

Decide your key policy in one place and make it non-negotiable for anything sensitive. If different keys genuinely need different rules, gate that choice behind a trusted policy layer, not a flag any caller can set.

Check your own code