CVE-2026-18215: Keycloak-services: keycloak-services: microsoft external access-token exchange bypasses configured tenant
A flaw was found in the Microsoft social identity provider in Keycloak. When a Microsoft identity provider is configured with a specific tenant ID, the restriction is correctly enforced for standard browser-based logins. However, the external access-token exchange endpoint fails to perform this validation. The root cause is that Keycloak calls the tenant-agnostic Microsoft Graph /me endpoint during the exchange process. It accepts the returned user profile and issues Keycloak tokens without verifying that the tenant associated with the original Microsoft token matches the configured tenant ID in the identity provider settings. An attacker with a valid Microsoft Graph access token from an arbitrary tenant can submit it to the Keycloak token exchange endpoint. Successful exploitation allows the attacker to bypass tenant restrictions, assume an identity within the Keycloak realm, and perform actions with the privileges of that identity, such as accessing protected resources or modifying user data.
Other sources
Keycloak provides a way to let users log in using Microsoft accounts while restricting access to a specific organization (tenant). A flaw was discovered where this restriction is ignored when using the token exchange feature. This means an attacker with a valid Microsoft token from a completely different organization could gain access to the Keycloak realm, potentially accessing sensitive data or performing unauthorized actions.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
Disable or block the Keycloak token exchange endpoint that performs external access-token exchange using Microsoft tokens, until the tenant-validation bypass is fixed.
- Operational
Review Keycloak realm logs/audit trails for any tokens issued via the Microsoft external access-token exchange endpoint from the affected Keycloak-services component, and revoke/rotate any impacted sessions or credentials.
Event History
Frequently Asked Questions
What is the severity of CVE-2026-18215?
CVE-2026-18215 has a medium severity score of 6.8.
How do I fix CVE-2026-18215?
To fix CVE-2026-18215, ensure that the latest security updates for the Microsoft Keycloak social identity provider are applied.
What is the impact of CVE-2026-18215?
CVE-2026-18215 allows an external access-token exchange to bypass the configured tenant restrictions for Microsoft identity providers.
Who is affected by CVE-2026-18215?
CVE-2026-18215 affects users of the Keycloak service that utilizes the Microsoft social identity provider.
What does CVE-2026-18215 mean for my Keycloak configuration?
CVE-2026-18215 indicates a vulnerability in the Microsoft external identity provider configuration that may compromise tenant security.