REDHAT-BUG-2499591: CSRF

Published Jul 13, 2026
·
Updated

A flaw was found in the keycloak-services component, specifically within the legacy client-initiated account-linking endpoint (/realms/{realm}/broker/{provider}/link). The endpoint validates a CSRF protection hash computed as SHA-256(nonce + userSessionId + clientId + providerAlias). The root cause is that all four inputs to this hash are accessible to a registered OIDC client: nonce is chosen by the attacker.

userSessionId is leaked as the sessionstate parameter in standard OIDC authorization responses (handled by OIDCLoginProtocol.java).

clientId and providerAlias are known to the client.

By obtaining the victim's sessionstate during a normal login flow, a malicious client can compute the required hash and generate a valid account-linking URL. If the client has the manage-account-links role (granted by default via fullScopeAllowed=true), the attacker can silently link their own upstream Identity Provider (IdP) identity to the victim's Keycloak account. Concrete Impact: Account Takeover: Attacker gains full access to the victim's account by logging in via the newly linked IdP.

Unauthorized Identity Linking: Attacker can link multiple malicious identities to a single victim account.

Data Exfiltration: Attacker can access all applications and data the victim is authorized to see.

Affected Software

1 affected component
Keycloak

Event History

Jul 13, 2026
Data Sourced
via Red Hat·07:13 AM
DescriptionSeverityAffected Software

Frequently Asked Questions

1

Who is realistically exposed to this issue?

Users who complete a normal OIDC login flow through a malicious registered OIDC client may be exposed. The client can obtain the victim's session_state from the authorization response and use it to construct a valid account-linking request.

2

What access does an attacker need to exploit it?

The attacker needs control of a registered OIDC client and must obtain the victim's session_state during the victim's login flow. The client also needs the manage-account-links role, which is granted by default when fullScopeAllowed=true.

3

What is the likely impact of successful exploitation?

An attacker can silently link an upstream IdP identity they control to the victim's Keycloak account. They can then log in through that linked identity and gain full access to the victim's account; multiple malicious identities may also be linked.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203