# CVE-2026-40948: Apache Airflow Providers Keycloak: OAuth Login CSRF — Missing State Parameter in Keycloak Auth Manager

> Attackers can force victims into attacker-controlled Airflow sessions via missing OAuth state validation, potentially harvesting stored credentials.

- **Severity:** Medium 5.4 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 18 Apr 2026
- **Updated:** 20 Apr 2026
- **Also known as:** GHSA-5w6h-pjw6-wvc6, PYSEC-2026-2369

## What is CVE-2026-40948?

CVE-2026-40948 is a medium-severity vulnerability in Apache Airflow Providers Keycloak, published on 18 Apr 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

The Keycloak authentication manager in `apache-airflow-providers-keycloak` did not generate or validate the OAuth 2.0 `state` parameter on the login / login-callback flow, and did not use PKCE. An attacker with a Keycloak account in the same realm could deliver a crafted callback URL to a victim's browser and cause the victim to be logged into the attacker's Airflow session (login-CSRF / session fixation), where any credentials the victim subsequently stored in Airflow Connections would be harvestable by the attacker. Users are advised to upgrade `apache-airflow-providers-keycloak` to 0.7.0 or later.

Weakness: CWE-352 (Cross-Site Request Forgery)

## Which versions are affected by CVE-2026-40948?

3 open source packages ship an affected version, including apache-airflow-providers-keycloak. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `apache-airflow-providers-keycloak` | PyPI | From 0.0.1 | 0.7.0 |
| `apache-airflow-providers-keycloak` | PyPI | From 0.0.1 | 0.7.0 |
| `apache-airflow-providers-keycloak` | PyPI | From 0.0.1 | 0.7.0 |

Products: Apache Apache-Airflow-Providers-Keycloak.

## How do I fix CVE-2026-40948?

Upgrade apache-airflow-providers-keycloak to 0.7.0 or later.

## Is CVE-2026-40948 being exploited?

There is no known exploitation of CVE-2026-40948 in the wild and no public exploit code.

## Other vulnerabilities in Apache Airflow Providers Keycloak

- [CVE-2026-76187](https://insights.sbomify.com/CVE-2026-76187/): Apache Airflow Keycloak provider: Any realm client's credentials mint an Airflow session JWT (critical 9.8)
- [CVE-2026-76186](https://insights.sbomify.com/CVE-2026-76186/): Apache Airflow Keycloak provider: Keycloak token cookies not bound to Airflow session identity (critical 9.1)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-40948 and fix it if it is affected.

What it is: CVE-2026-40948 is a medium-severity vulnerability in Apache Airflow Providers Keycloak, published on 18 Apr 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2026-40948 in the wild and no public exploit code.

Affected packages and fixed versions:
- apache-airflow-providers-keycloak (PyPI): affected from 0.0.1; fixed in 0.7.0
- apache-airflow-providers-keycloak (PyPI): affected from 0.0.1; fixed in 0.7.0
- apache-airflow-providers-keycloak (PyPI): affected from 0.0.1; fixed in 0.7.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-40948/ (Markdown: https://insights.sbomify.com/CVE-2026-40948/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-40948
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-40948
- OSV: https://osv.dev/vulnerability/CVE-2026-40948

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-40948/
Summaries are generated and may contain mistakes; the official description above is the record.
