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
@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@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)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.
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
- Find key generation or rotation that trusts a caller-supplied target id
- Authorize the target tenant or application, and never the caller's role alone
- Separate create from replace and gate replacement harder
- Alert on key material generated for a tenant the caller does not own