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

Deleting a key needs nothing but the key's name

A caller hands over an alias, the code checks it exists, then deletes it from the keystore. No biometric, no ownership check. A known name is the only requirement.

caller passes analiascode confirms itexistsno authorizationgatekey deletedpermanentlyATTACKER INPUTIMPACTcheck absent
Attack path · caller passes an alias → code confirms it exists → no authorization gate → key deleted permanently

A caller hands over an alias, the code checks it exists, then deletes it from the keystore. No biometric, no ownership check. A known name is the only requirement.

What goes wrong

Deletion is the keystore operation people forget to protect. Reading or signing feels sensitive, so those get a biometric prompt. Removing a key looks like housekeeping, so it gets an existence check and nothing else. The caller names a key, the code confirms the alias is present, and the key is gone.

There is no undo. A deleted signing key cannot be recreated, and anything encrypted under a deleted key is unrecoverable. If another app, an exported interface, or a stray component can reach this call, it can wipe credentials and lock users out of their own accounts.

The pattern

Vulnerable
function deleteKey(alias):
    // existence is the only check
    if (!keystore.contains(alias)):
        return NOT_FOUND
    keystore.delete(alias)   // destructive, no auth gate
    return OK
Hardened
function deleteKey(alias, authResult):
    if (!keystore.contains(alias)):
        return NOT_FOUND
    if (!authResult.isFreshBiometric()):
        return UNAUTHORIZED
    if (!callerOwns(alias)):
        return FORBIDDEN
    keystore.delete(alias)
    return OK
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

This will not leak a secret, so it scores lower than a read would. It is still a denial of service you cannot walk back. Losing a signing key can wreck a user's ability to authenticate or recover their account, with no path to restore it. Destructive operations deserve the same gate you put on reads, and sometimes a stronger one.

Check your own code