The CSR endpoint takes the subject and the application it represents from the request, checks your role, and signs off. Name an identity that isn't yours and it obliges.
What goes wrong
A certificate signing request endpoint takes a request object from the body and generates a CSR from it. The object carries the application or reference identity and the subject fields that will end up in the certificate. The controller checks a role and passes the object straight through.
Since the caller fills in the identity, the caller can put someone else's there. A permitted role can request a CSR that represents an application or domain it has no claim to. Depending on what your certificate authority does next, that request can turn into a real certificate for an identity the requester should never be able to assert.
Authorizing the caller's role is not the same as authorizing the identity in the request. The CSR is a statement of 'I am this thing', and the endpoint is signing that statement without checking whether the caller is that thing.
The pattern
@RequireRole('csr-user')
def generateCsr(req):
subject = req.subject # caller writes the identity
appId = req.applicationId
return csr.create(appId, subject) # no identity binding@RequireRole('csr-user')
def generateCsr(req):
appId = req.applicationId
if not caller.owns(appId):
deny()
subject = subjectFor(appId) # server sets the identity
return csr.create(appId, subject) # caller cannot forge itGrounding 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.
Why it matters to you
A CSR that names an identity the requester does not control is a request to impersonate that identity in certificate form. If your issuing pipeline trusts the CSR's contents, the attacker walks away with a credential for another application or domain. Even when a human approves, a plausible-looking CSR is a good way to slip one past a tired reviewer.
Put the subject identity under server control. Derive it from the application the caller is proven to own, rather than copying it out of the request, and reject any CSR whose identity the caller cannot claim.
Check your own code
- Check who supplies the subject and identity fields in a CSR request
- Bind the requested application identity to the authenticated caller
- Derive certificate subject fields server-side from authorized data
- Reject CSRs asserting an identity the caller cannot prove they own