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

Any role holder can sign anything with your key

Your endpoint hands caller-supplied bytes to a hardware-backed signing key and returns a trusted signature. It checks the caller's role and nothing about what they are signing.

Caller postsarbitrary…Controller checksonly that…Bytes go straightto the…A signature overattacker-chosen…That signature istrusted elsewhereATTACKER INPUTIMPACTused as an oracle
Attack path · Caller posts arbitrary bytes to the signing endpoint → Controller checks only that the caller holds a role → Bytes go straight to the hardware signing key → A signature over attacker-chosen content is returned → That signature is trusted elsewhere

Your endpoint hands caller-supplied bytes to a hardware-backed signing key and returns a trusted signature. It checks the caller's role and nothing about what they are signing.

What goes wrong

An endpoint takes bytes from the request body and asks a hardware-backed key to sign them. The only guard is a role check. If you hold the role, you can submit any content you like and get back a signature that the rest of the system, and possibly other systems, will treat as authentic.

A signing key is supposed to attest to specific things, like a particular token or a particular build. When the endpoint puts no constraint on what gets signed, it stops being a signing service and becomes a signing oracle. Nothing ties the request to a purpose or to the caller who made it. The key will sign a forged authorization payload as happily as a legitimate one.

Role-based access answers who can call the function. It says nothing about whether this caller should be allowed to produce this particular signature. Those are different questions, and only one of them is being asked.

The pattern

Vulnerable
@RequireRole('signer')
def sign(request):
    payload = request.body.bytes        # attacker-chosen
    signature = hsm.sign(KEY_ID, payload)
    return { 'signature': signature }   # trusted everywhere
# no check on what payload is, or who it is for
Hardened
@RequireRole('signer')
def sign(request):
    doc = parseAndValidate(request.body)      # known shape only
    requireOwnership(caller, doc.subject)     # caller's own data
    requirePurpose(doc.type, allowedPurposes)
    payload = canonicalize(doc)               # server builds bytes
    return hsm.sign(keyFor(doc.type), payload)
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

The blast radius depends on what that signature buys. If it authenticates messages between services, an attacker mints trusted messages. If it signs entitlements or updates, they sign their own. A signature your infrastructure trusts by default is one of the highest-value primitives you expose, and an unconstrained signing route gives it away to everyone who cleared the role gate.

The rule that holds up: never sign raw caller input. Build the thing to be signed on the server from validated fields and tie it to the caller and a purpose. Use a key scoped to that purpose so one leak does not authorize everything.

Check your own code