Skip to content

[CVE-2026-16089] Authorization codes can be retargeted to another cli… - #52062

Merged
mposolda merged 1 commit into
keycloak:mainfrom
mposolda:51003-authz-code-retarget
Aug 26, 2026
Merged

mposolda merged 1 commit into
keycloak:mainfrom
mposolda:51003-authz-code-retarget

Conversation

@mposolda

Copy link
Copy Markdown
Contributor

…ent session

closes #51003

Besides the fix, there is minor code cleanup to removed unused method in OID4VCIssuerEndpointTest and then unused constructor on OAuth2Code

Copilot AI balanced review requested due to automatic review settings August 26, 2026 08:46
@mposolda
mposolda requested a review from a team as a code owner August 26, 2026 08:46
@mposolda mposolda self-assigned this Aug 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Binds authorization codes to their originating client UUID, preventing code retargeting.

Changes:

  • Persist and validate the originating client UUID.
  • Add a regression test for CVE-2026-16089.
  • Remove obsolete OID4VC test code and constructor.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
OID4VCIssuerEndpointTest.java Removes unused helper code.
AuthorizationCodeTest.java Tests rejection of retargeted codes.
OAuth2CodeParser.java Validates client binding.
OAuth2Code.java Serializes the client UUID.
OIDCLoginProtocol.java Records the originating client UUID.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

// We allow "persistedClientUUID" to be null just because zero-downtime upgrade between micro versions (as older KC versions might not have clientUUID stored).
// This might be removed in the future version
if (persistedClientUUID != null && !clientUUID.equals(persistedClientUUID)) {
logger.warnf("Code '%s' is bound to a different client", clientUUID);
…ent session

closes keycloak#51003

Signed-off-by: mposolda <mposolda@gmail.com>
Copilot AI review requested due to automatic review settings August 26, 2026 12:59
@mposolda
mposolda force-pushed the 51003-authz-code-retarget branch from 684e2f7 to e745c21 Compare August 26, 2026 12:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

services/src/main/java/org/keycloak/protocol/oidc/utils/OAuth2CodeParser.java:119

  • This warning reports the supplied client UUID as the client to which the code is bound, even though the condition proves the opposite. Reword it so security diagnostics do not misidentify the bound client.
            logger.warnf("Code is bound to a different client '%s'", clientUUID);

Comment on lines +116 to +118
// We allow "persistedClientUUID" to be null just because zero-downtime upgrade between micro versions (as older KC versions might not have clientUUID stored).
// This might be removed in the future version
if (persistedClientUUID != null && !clientUUID.equals(persistedClientUUID)) {

@graziang graziang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mposolda thanks!

@mposolda

Copy link
Copy Markdown
Contributor Author

@graziang Thank you!

@mposolda
mposolda merged commit 6eb0a6c into keycloak:main Aug 26, 2026
94 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CVE-2026-16089] Authorization codes can be retargeted to another client session

3 participants