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
function deleteKey(alias):
// existence is the only check
if (!keystore.contains(alias)):
return NOT_FOUND
keystore.delete(alias) // destructive, no auth gate
return OKfunction deleteKey(alias, authResult):
if (!keystore.contains(alias)):
return NOT_FOUND
if (!authResult.isFreshBiometric()):
return UNAUTHORIZED
if (!callerOwns(alias)):
return FORBIDDEN
keystore.delete(alias)
return OKEvery gate held. The exploit path was reproduced against a negative control, the impact was calibrated, and the finding was signed report-ready.
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
- Inventory every destructive keystore or credential operation and check what authorizes it.
- Confirm delete paths require the same or stronger auth than read paths.
- Verify the caller is allowed to touch the specific alias, beyond checking that it exists.
- Ask what happens to user data if this key disappears, then gate accordingly.