Home/ Blog/ Security news/ Article
Blog · Security news

Keycloak lets an outside Google account bypass your Workspace domain sign-in restriction (CVE-2026-18214)

A missing check in Red Hat Build of Keycloak lets an outside Google account bypass a Google Workspace domain restriction during token exchange.

Keycloak Google domain restriction bypass shown as tokens passing an unguarded side gate

The rule you set on Google sign-in, "only accounts from our company's Workspace domain," holds on the front door and gets waved through on a side door. That gap is CVE-2026-18214, a missing-authorization flaw in Red Hat Build of Keycloak disclosed on July 31 and credited to Paul Bottinelli at Trail of Bits. It carries a medium rating (CVSS 6.8), there is no report of it being exploited, and no fixed package has shipped. It still deserves an afternoon, because the control it defeats is one teams deliberately switch on to keep strangers out.

Keycloak is a widely deployed open-source identity and access management server. A Keycloak setup can use Google as an identity provider and can be pinned to a single Google Workspace domain, so that only, say, @yourcompany.com accounts are let through. Google carries that membership in a token field called hd (hosted domain). Sign in the normal way and Keycloak reads hd and enforces it. Arrive by a different route and it does not.

What actually broke

Keycloak also offers token exchange, which trades an external token, here a Google access token, for a Keycloak-issued one so an application can act for the user. Keycloak inspects hd when a person logs in interactively, but the code that accepts an incoming Google access token never runs that same comparison, per Red Hat's bug report. On that route Keycloak fetches the account's profile from Google and then admits it without ever measuring the account's domain against the one you pinned the connection to. The single check that gives the restriction any teeth is simply absent.

Source: Red Hat Bugzilla 2508308, CVE-2026-18214.
Keycloak sign-in pathChecks the Google domain (`hd`)?Domain restriction
Interactive Google loginYesEnforced
External access-token exchange (Token Exchange V1)NoBypassed

Put it together: someone holding any working Google token, from any domain at all, who can reach a confidential client cleared to run token exchange, can swap that Google token for a Keycloak one and walk into a login that was meant to exclude them. The severity math sits at medium mainly because of that setup cost, not because the payoff is small. Once it works, confidentiality and integrity both take a full hit while availability is untouched. Red Hat adds that the same path can be used to spin up or attach a federated account the domain rule was meant to keep out, which is the part that outlasts a single session.

Who is actually exposed

This is not every Keycloak install. You are in scope only when all of these hold at once:

  • Google is set up as an identity provider.
  • That connection carries a hosted-domain restriction (the "our domain only" control).
  • Token Exchange V1 is enabled.
  • A confidential client is allowed to run token exchange, and an attacker can drive it with a Google access token.

Red Hat names the affected software as Red Hat Build of Keycloak, in the keycloak-services component shipped through rhbk-keycloak-rhel9 and rhbk-openshift-rhel9. It marks Red Hat Single Sign-On 7, Red Hat Data Grid 8, and the JBoss Enterprise Application Platform Expansion Pack as not affected. Teams running upstream Keycloak with the same Google broker and token-exchange setup should assume they may be in scope and follow the project's advisories, since the faulty logic lives in keycloak-services itself.

Why token-exchange flows keep doing this

Worth a defender's attention past this one CVE: Keycloak's alternate token paths have tripped on this same shape before. Earlier this year CVE-2026-1486 covered the JWT authorization-grant flow neglecting to confirm whether an identity provider was even enabled during token exchange. Different field, same category of miss: a guard the interactive login runs is missing on an exchange or alternate-grant route. Anyone operating an identity broker should stop assuming a restriction proven on the login screen also holds on every other way a token can arrive. Each grant type is its own entrance, and each one needs the guard posted.

We looked at another Keycloak issue last week, a view-only admin able to read live client secrets, and it rhymed: a check that held in one spot did not hold in another. It also echoes single sign-on bypasses elsewhere, like the miniOrange SSO plugin flaw that researchers reported could let a stranger log in as WordPress admin. Federation keeps moving the trust decision to a place you may not be watching.

How to contain this before a patch lands

No fixed version exists yet, so today's work is trimming exposure and turning on the lights.

  • Confirm you are exposed at all. Check each Keycloak configuration for a Google identity provider carrying a hosted-domain restriction. No such pairing, no exposure through this path.
  • Cut who can run token exchange. The attack needs a confidential client cleared for token exchange, so use Keycloak's fine-grained permissions to grant that only where an application truly needs it, and strip it everywhere else.
  • Switch off Token Exchange V1 if nothing uses it. With no application depending on external token exchange, disabling the feature shuts this route.
  • Stop leaning on the domain rule as the only gate. Layer a group or role mapping that independently confirms a federated user belongs, rather than trusting hd to police everything.
  • Follow Red Hat's advisory. Watch the CVE page for the errata and apply the corrected keycloak-services package the moment it lands.

How to tell if it was already used

Because the bypass mints a genuine, admitted account, the giveaway is a Google-federated user whose email domain is not the one you allowed. Comb Keycloak's login and identity-broker events for Google accounts sitting outside your permitted domain, and give extra weight to identities born from a token-exchange call rather than an interactive sign-in. If your domain rule is working on the front door, an outside Google account already inside is a contradiction worth chasing down. The clean way to close the gap until the fix ships is to verify the email domain of every federated Google account yourself, instead of trusting that the restriction did it.

Medium score aside, a control that quietly stops applying is worse than one you know is off, because you have already looked away. That is the real bill here, and it is why this is worth handling before the errata arrives.

Frequently asked questions

What is CVE-2026-18214?

CVE-2026-18214 is a missing-authorization flaw in Red Hat Build of Keycloak. When a Keycloak configuration restricts Google sign-in to a specific Workspace domain, the token exchange path fails to check that restriction, so an account from another domain can bypass it. It is rated CVSS 6.8 (medium).

Which Keycloak configurations are affected?

A configuration is exposed only if it uses Google as an identity provider with a hosted-domain restriction, has the Token Exchange V1 feature enabled, and has a confidential client authorized to perform token exchange. Deployments missing any one of those conditions are not exposed through this specific path.

Is CVE-2026-18214 being exploited, and is there a patch?

As of disclosure on July 31, 2026, there is no public report of exploitation and Red Hat has not yet published a fixed package. Track Red Hat's CVE advisory for the errata, and in the meantime restrict token-exchange clients or disable Token Exchange V1 if it is unused.

How do I reduce exposure to the Keycloak token-exchange bypass now?

Use Keycloak's fine-grained permissions to allow token exchange only on clients that need it, and disable Token Exchange V1 entirely if nothing uses it. Add a group or role check that independently confirms a federated user's domain rather than relying on the Google hosted-domain restriction alone.

How can I detect if this bypass was used against my Keycloak setup?

Review Keycloak's login and identity-broker events for Google-federated users whose email domain falls outside your allowed Workspace domain, especially identities created or linked through token exchange rather than interactive login. An out-of-domain Google account inside a domain-restricted login is the signal to investigate.

Ready to meet the Guardians?

Deploys fast - agentless for monitoring and cloud, a lightweight agent for deep endpoint security. Just Suriq, standing watch.