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

When the last status entry wins, revoked disappears

Your verifier keys each result by a value the credential carries. Feed it two entries with the same key and the second overwrites the first. Guess which one the attacker wants to land last.

Caller submits acredential…Each entry's keyis derived…Resultsaccumulate into…A benign entryoverwrites…Downstream truststhe final statusATTACKER INPUTIMPACTtrust boundary crossed
Attack path · Caller submits a credential with status entries → Each entry's key is derived from the credential → Results accumulate into a map, last write wins → A benign entry overwrites a revoked one → Downstream trusts the final status

Your verifier keys each result by a value the credential carries. Feed it two entries with the same key and the second overwrites the first. Guess which one the attacker wants to land last.

What goes wrong

You verify a credential that carries a list of status entries. Each entry gets checked, and you file the outcome under a key. The catch: the key comes from the credential itself, so the caller decides it. When two entries share a key, your map keeps the one that landed last.

That is enough to hide a bad result. An attacker adds a second entry whose key matches the first, but whose outcome is clean. The revoked or suspended result gets checked, recorded, then quietly replaced. Downstream code reads the map, sees a passing status, and lets the request through.

The map never lied. It did exactly what a last-write-wins merge does. The mistake was treating caller-supplied data as a trusted key and letting a later write clobber a security decision that had already been made.

The pattern

Vulnerable
results = {}
for entry in credential.statusEntries:
    key = entry.purpose          # attacker controls this
    outcome = checkStatus(entry)
    results[key] = outcome       # last write silently wins
return results[key]              # trusted downstream
Hardened
results = {}
for entry in credential.statusEntries:
    key = entry.purpose
    outcome = checkStatus(entry)
    if key in results:
        outcome = worst(results[key], outcome)  # never soften
    results[key] = outcome
assertNoDuplicateKeys(credential)  # or reject up front
return results[key]
How the pipeline adjudicated itPROVEN
ABCDEFGH

Every gate held. The exploit path was reproduced against a negative control, the impact was calibrated, and the finding was signed report-ready.

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

Why it matters to you

Any system that merges results into a keyed collection can hit this, whether you are checking credential status or per-scope permissions. If the key is attacker-reachable and a later value can overwrite an earlier one, a negative result is one duplicate away from vanishing.

The fix costs almost nothing. Decide up front whether duplicates are even legal, and if they are, fold them so the safest answer survives instead of the newest one.

Check your own code