Blog / A01:2021 Broken Access Control
A01:2021 · Broken Access Control

A branch that hands back private keys without asking

Two hardcoded values trigger the biometric prompt. Every other value falls into the else branch, fetches the matching private key, and returns it with no check at all.

caller sets theselector valuecode maps it tokey aliasesonly two valueshit the…any other valueskips authprivate key isreturnedATTACKER INPUTIMPACTcheck absent
Attack path · caller sets the selector value → code maps it to key aliases → only two values hit the biometric branch → any other value skips auth → private key is returned

Two hardcoded values trigger the biometric prompt. Every other value falls into the else branch, fetches the matching private key, and returns it with no check at all.

What goes wrong

The auth gate was written for the happy path. Someone handled the two key types they expected, wrapped those in a biometric prompt, and let the else branch catch everything else. That else branch still resolves an alias and returns the private key. It just skips the prompt. Pass any third value and you get a key with no authentication.

There's a second problem in the branch that does prompt. The check is a generic "is the user present" prompt, not one bound to the specific key it releases. A successful auth for one operation can be reused to release a different key. Binding the prompt to the exact key is the entire reason the hardware exists.

This is what happens when authorization keys off input values instead of a positive allowlist. The default case should be denial. Here it is release.

The pattern

Vulnerable
function getPrivateKey(account):
    alias = aliasFor(account)
    if (account == "type-a" || account == "type-b"):
        if (!biometricOk()):        // generic presence prompt
            return DENIED
        return load(alias)
    else:
        return load(alias)          // no auth at all
Hardened
function getPrivateKey(account, request):
    if (!isAllowedType(account)):
        return REJECTED             // deny unknown selectors
    alias = aliasFor(account)
    if (!callerOwns(alias)):
        return FORBIDDEN
    // prompt bound to this exact key
    key = load(alias, boundBiometric(alias))
    if (key == null):
        return DENIED
    return key
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

Returning a private key to the caller is close to the worst outcome a key store can have. Once the key leaves the secure boundary, every signature and decryption it can produce is up for grabs, and rotation is your only recovery. An authorization scheme that protects two named cases and waves the rest through is not protecting anything. Default to deny, then allow only what you can name.

Check your own code