Summary
Apache Airflow's Keycloak authentication integration may accept valid client credentials belonging to any confidential client in a shared Keycloak realm, rather than only the client configured for Airflow. An attacker who obtains credentials for an unrelated application may use the unauthenticated token endpoint to receive an Airflow session token representing that application's service account.
Affected context
The issue affects deployments using the Apache Airflow Keycloak auth manager where the configured Keycloak realm is shared by multiple confidential clients. It becomes risky when the authentication flow does not restrict accepted client identifiers to the client explicitly configured for Airflow, allowing credentials issued to another application to be treated as valid Airflow credentials.
Exploit preconditions
- Attack surface: Airflow's unauthenticated Keycloak token endpoint
- Required access: Valid credentials for any confidential client in the shared Keycloak realm; Airflow-specific credentials are not required
- Trigger point: A client-credentials authentication request submitted to the Airflow authentication endpoint
- Why exploitation is possible: The provider accepts credentials for realm clients without enforcing an allowlist containing only the configured Airflow client
Why this happens
The authentication flow validates client credentials against the shared Keycloak realm but does not bind successful authentication to the specific client configured for Airflow. This creates an identity and audience-confusion condition in which an unrelated application's service account can be accepted as an Airflow login principal. The behavior maps to CWE-287: Improper Authentication, because the system fails to correctly verify that the presented credentials belong to an authorized Airflow client.
Potential impact
- An attacker could obtain an Airflow session token for an unrelated service account
- The attacker may access Airflow functionality available to that service account
- Endpoints gated only by authentication could become reachable
- The attacker could perform actions permitted by the service account's Airflow roles
- Credential-guessing activity could be relayed to Keycloak under Airflow's identity
General mitigation guidance
Mitigation generally focuses on binding client-credentials authentication to the intended Airflow client and reducing trust in shared-realm identities.
Common defensive patterns include:
- Enforcing an explicit allowlist containing only the configured Airflow client identifier
- Verifying the token subject, audience, issuer, and client identity consistently
- Separating Airflow authentication into a dedicated realm or otherwise isolating client populations
- Applying least privilege to service accounts and limiting their Airflow roles
- Restricting unauthenticated authentication endpoints through rate limits, monitoring, and network policy where practical
- Ensuring resource authorization remains enforced after authentication
How teams detect issues like this
Organizations can look for:
- Static analysis or review rules that identify authentication flows lacking client-identifier allowlists
- Code paths that validate realm credentials without checking the configured application client
- Tests confirming that credentials for unrelated confidential clients are rejected
- Authentication logs showing successful Airflow sessions associated with unexpected client IDs or service accounts
- Policy checks requiring explicit audience, issuer, subject, and client binding for token-based authentication
Automated security testing and code-review tools can help identify missing authorization boundaries and cross-application credential acceptance.

