Post a ciphertext, get back plaintext. The endpoint checks the caller's role and never checks whose ciphertext it is or what key should touch it.
What goes wrong
An endpoint takes ciphertext and decryption parameters from the request body, passes them to a hardware-backed key, and returns the plaintext. The only gate is a role. If you hold it, you can submit ciphertext you did not create and read what comes out.
Nothing ties the request to ownership, tenant, or the intended purpose of the key. The service will decrypt a blob captured from another user's traffic or another tenant's storage, as long as it was encrypted under a key this endpoint can reach. You have a general-purpose decryption oracle sitting behind a role check.
A decrypt operation is a capability, and role-based access controls who can invoke the capability, not what they are allowed to point it at. Those are different, and only the first is enforced.
The pattern
@RequireRole('decryptor')
def decrypt(req):
ct = req.ciphertext # attacker-supplied blob
params = req.params
pt = hsm.decrypt(KEY_ID, ct, params)
return { 'plaintext': pt } # no context check at all@RequireRole('decryptor')
def decrypt(req):
ref = lookupCiphertext(req.id) # server-side handle
requireOwnership(caller, ref.owner) # caller's own data
requireKeyPurpose(ref.keyId, 'user-data')
pt = hsm.decrypt(ref.keyId, ref.ciphertext, ref.params)
return { 'plaintext': pt }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
A decryption oracle collapses your encryption at rest and in transit down to whoever can call this route. Secrets you assumed were protected because they were encrypted are readable on demand. If the same key protects multiple tenants or purposes, one endpoint undoes the separation you designed the key hierarchy to provide.
Do not accept raw ciphertext and decrypt it on trust. Reference stored ciphertext through a handle you control, verify the caller owns it, and scope keys by purpose so a single decrypt route cannot open everything.
Check your own code
- Find decrypt calls fed ciphertext straight from the request body
- Require the caller to own the ciphertext they ask to decrypt
- Scope keys by purpose and tenant, not one key for every call
- Log decrypt requests with caller, key, and target for review