/

CVE-2025-54550

Severity:

HIGH RISK

(8.1)

Code Injection in Airflow XCom Documentation Example

CVE-2025-54550

Analyzed

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Arbitrary Code Execution within Airflow Workers

Severity:

HIGH RISK

(8.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A documentation example for using XComs in Apache Airflow demonstrated an unsafe pattern that could let a UI user with permission to modify XCom values trigger arbitrary code execution on a worker.

While the example DAGs are not intended for production and UI users are generally highly trusted, copying this pattern into real workflows can create a hidden code injection risk.

Affected context

This issue arises in Airflow environments where:

  • Example DAGs from the documentation are enabled, or
  • Production DAGs have been implemented by copying the unsafe example_xcom pattern.

The vulnerable context involves tasks that:

  • Read XCom values and interpret them as executable code or dynamically evaluated expressions, and
  • Run in worker processes with permissions to access Airflow resources and potentially connected systems.

It does not affect Airflow core logic directly but rather any user pipelines that replicate the documented anti-pattern.

Exploit preconditions

  • Attack surface: Airflow web UI or any interface that allows modification or injection of XCom values.
  • Required access: Authenticated UI user or operator role with permissions to view and edit XComs or otherwise control their content.
  • Trigger point: A task that consumes an XCom value using an evaluation mechanism (e.g., dynamic execution of the XCom content) during DAG run on a worker.
  • Why exploitation is possible: The example pattern treats XCom contents as trusted executable input instead of as plain data, allowing an attacker with XCom write access to craft values that are interpreted as code.

Why this happens

The underlying issue reflects CWE-94: Improper Control of Generation of Code ('Code Injection').

The documentation example showed how to pull data from XCom and then process it in a way that effectively executed or dynamically evaluated the retrieved value.

XComs are a general-purpose data channel and may be modified by privileged UI users or automation, but the example implicitly trusted the XCom payload as safe code rather than untrusted data.

This conflation of data and executable logic is the core insecure pattern, and reproducing it in user DAGs embeds a code injection sink into worker tasks.

Potential impact

  • Arbitrary code execution within Airflow worker processes using malicious XCom payloads.
  • Unauthorized access to data sources and sinks reachable by the compromised worker.
  • Lateral movement inside the Airflow deployment or broader infrastructure, depending on worker permissions.
  • Data exfiltration, tampering with workflow outputs, or manipulation of task behavior.
  • Abuse of the worker environment to run unintended compute workloads.

General mitigation guidance

Mitigation should focus on treating XCom values as untrusted data and eliminating dynamic code execution based on their content.

Common defensive patterns include:

  • Avoiding eval, dynamic import, or any direct execution of strings or serialized structures pulled from XCom.
  • Designing tasks so that XComs carry parameters or data only, with code paths defined statically in the DAG or operator configuration.
  • Constraining acceptable XCom formats (e.g., JSON, typed objects) and validating them before use.
  • Applying least-privilege principles to worker environments so that, if misuse occurs, the blast radius is limited.
  • Encouraging documentation and internal guidelines that explicitly forbid dynamic execution patterns based on runtime XCom content.

How teams detect issues like this

Detection efforts can focus on identifying code patterns where XCom values influence executable code paths:

  • Static analysis rules that flag usage of eval, exec, dynamic imports, or template rendering where the source is xcom_pull or similar APIs.
  • Code review practices that scrutinize any logic bridging XCom content and dynamic execution or reflection features.
  • Policy checks in CI/CD pipelines that fail builds when known dangerous constructs are combined with XCom access.
  • Periodic review of DAG repositories to find legacy examples copied from documentation that treat XCom data as code rather than as pure data.

Sources

SourceLink
github.comgithub.com/apache/airflow/pull/63200
lists.apache.orglists.apache.org/thread/3mf4cfx070ofsnf9qy0s2v5gqb5sc2g1
openwall.comopenwall.com/lists/oss-security/2026/04/15/1

Frequently asked

questions

It is generally limited to authenticated users with access to modify XComs or influence their content. Remote exploitation depends on how broadly the Airflow UI or APIs are exposed and which roles attackers can obtain.

An attacker must be able to control the value stored in XComs that are later consumed by the unsafe pattern, typically requiring UI access with permissions to edit or inject XCom entries or to run tasks that push crafted XCom values.

Remove any dynamic execution of XCom contents: treat XCom as data only, refactor tasks so that all executable logic is statically defined, and ensure that any values pulled from XCom are parsed and validated as data structures, not executed as code.

Establish coding standards that forbid execution of user-controlled or workflow-controlled strings, apply automated checks for dangerous interpreter functions tied to XCom usage, and ensure that future documentation and internal examples demonstrate safe, data-only XCom patterns.

Find out what's already
exploitable in your codebase.