Summary
OpenAM's private_key_jwt client authentication can fail to bind a cached JWKS resolver and verified assertion to the client ID being authenticated. A client controlling its own published keys may exploit this weakness to authenticate as another client whose keys are exposed through jwks_uri and mint tokens in that client's name.
Affected context
The issue affects OpenAM's private_key_jwt client authentication path when ClientCredentialsReader uses ClientJwksResolverCache. Risk arises when the resolver or verified assertion is not reliably associated with the expected client ID, and another client's keys are exposed through jwks_uri. Open dynamic registration can provide a way to obtain a registered client with published keys when that feature is enabled. The described cross-client impact can span realms in the same OpenAM process.
Exploit preconditions
- Attack surface: OpenAM's
private_key_jwtclient authentication flow. - Required access: Control of a registered client with published keys; open dynamic registration may provide this capability if enabled.
- Target condition: Another client must have keys exposed through
jwks_uri. - Trigger point: Authentication processing that uses the cached JWKS resolver and verifies the client's assertion.
- Why exploitation is possible: The cached resolver and verified assertion are not reliably bound to the client ID expected by the authentication flow.
Why this happens
The underlying flaw is an authentication identity-binding failure. In the private_key_jwt path, cached key-resolution state and assertion verification are not reliably tied to the expected client ID. As a result, successful verification can be attributed to the wrong client identity. This maps to CWE-287: Improper Authentication, because the system may accept an authentication assertion as belonging to a client other than the one it represents.
Potential impact
- An attacker may authenticate as another client.
- An attacker could mint tokens in the impersonated client's name.
- Tokens may grant access to resources available to that client.
- The impact may extend across realms in the same OpenAM process.
General mitigation guidance
Mitigation generally focuses on preserving client identity throughout authentication and minimizing the trust placed in shared resolver state.
Common defensive patterns include:
- Binding JWKS resolution, assertion verification, and authentication results to the expected client ID.
- Scoping caches by client identity and validating cache entries before reuse.
- Applying strict authorization and validation checks to dynamic client registration.
- Limiting which clients can publish or use key endpoints, and restricting endpoint access where appropriate.
- Applying least privilege to client registrations and token scopes.
How teams detect issues like this
High-level detection approaches may include:
- Reviewing authentication code and static analysis results for cached key resolvers or verification results reused across client identities.
- Checking that client IDs are consistently validated when resolving JWKS, verifying assertions, and issuing tokens.
- Monitoring for authentication and token issuance events where the asserted client, resolved key owner, and resulting token subject or client identity do not match.
- Enforcing review policies for changes to client authentication, JWKS caching, and dynamic registration.

