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

Generating master keys for a tenant that isn't yours

The key-generation call takes the target application id from the request and forwards it to key management after a role check. Point it at another tenant and it obliges.

Caller sends akey-generation…The request namesthe…Controllerapplies a…Request isforwarded to…Key material iscreated…ATTACKER INPUTIMPACTcheck absent
Attack path · Caller sends a key-generation request → The request names the target application or tenant → Controller applies a coarse role check → Request is forwarded to key management as-is → Key material is created or replaced for another tenant

The key-generation call takes the target application id from the request and forwards it to key management after a role check. Point it at another tenant and it obliges.

What goes wrong

A key-generation endpoint lets the caller control the request, including which application or tenant the key belongs to. The controller runs a coarse role check and forwards the request to the key-management operation. If that operation trusts the identifiers it receives, the caller decides whose keys get generated.

Name another application, and you can create or replace its master key material. Replacing a live key is the more dangerous half: you can rotate an application into a key only you know, or into one that breaks its ability to decrypt what it stored under the old key. Either way you are operating a security control that belongs to someone else.

The controller's role check answers a question about the caller. It does not answer the question that matters here, which is whether this caller may generate keys for this target. Nothing in the path forces that question to be asked.

The pattern

Vulnerable
@RequireRole('key-admin')
def createMasterKey(req):
    appId = req.applicationId       # caller names the tenant
    return keys.generate(appId)     # forwarded as-is, no bind
# can create or overwrite key material for any appId
Hardened
@RequireRole('key-admin')
def createMasterKey(req):
    appId = req.applicationId
    if not caller.owns(appId):          # authorize the target
        deny()
    if keys.exists(appId):
        requireRotationApproval(appId)  # guard destructive replace
    return keys.generate(appId)
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

Master key generation is close to the root of a lot of trust. Create keys for another tenant and you may be able to read what those keys protect. Overwrite existing keys and you can lock a tenant out of their own data or take it over, which turns a missing authorization check into both a data-loss and a takeover risk.

Guard the destructive path hardest. Bind every key operation to a target the caller is proven to own, and make replacing an existing key take more than a single role and a caller-supplied id.

Check your own code