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

The target app id sits in the body, and it isn't yours

An upload endpoint takes a certificate and the id of the app it belongs to, then replaces that app's cert. It trusts the id in the body because you cleared the role check.

Caller uploads acertificate and…Controllerauthorizes…Service updatesthe…No binding tiesthe app id to…Anotherapplication's…ATTACKER INPUTIMPACTcheck absent
Attack path · Caller uploads a certificate and a target app id → Controller authorizes by role only → Service updates the certificate for that app id → No binding ties the app id to the caller → Another application's certificate is replaced

An upload endpoint takes a certificate and the id of the app it belongs to, then replaces that app's cert. It trusts the id in the body because you cleared the role check.

What goes wrong

The endpoint reads a certificate and the identifiers of the application it targets, both from the request body, and calls the update operation. Authorization is a role check in the controller and nothing more.

Because the target application id travels in the body, the caller picks it. A user with the role can name an application that belongs to someone else and overwrite its trusted certificate. Every client that authenticates or validates that application is now working against material the attacker supplied.

The controller confirmed the caller is the kind of user allowed to upload certificates. It never confirmed the caller owns the application whose certificate is about to change. That second check is the one that matters here, and it is not present in the controller or, apparently, the service.

The pattern

Vulnerable
@RequireRole('app-admin')
def uploadCert(req):
    appId = req.applicationId      # from the body
    cert = req.certBytes
    certs.replace(appId, cert)     # any app, no owner check
    return ok()
Hardened
@RequireRole('app-admin')
def uploadCert(req):
    appId = req.applicationId
    if not caller.owns(appId):        # bind target to caller
        deny()
    cert = parseAndValidate(req.certBytes)
    certs.replace(appId, cert)
    audit(caller, 'cert-replace', 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

Replacing an application's certificate is a quiet way to break or subvert its authentication. Depending on how that cert is used, an attacker can knock the app offline, impersonate it, or position for interception, all from a routine-looking upload. The endpoint reads like plumbing, which is exactly why the missing ownership check survives review.

Whenever a write targets an object named in the request, authorize the object, not the action. The service is the right place for it, because that is the layer that cannot be bypassed by a second caller path into the same operation.

Check your own code