/

CVE-2024-56373

Severity:

HIGH RISK

(8.4)

Code Injection in Apache Airflow 2 Web Server

CVE-2024-56373

Analyzed

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Remote Code Execution within the Airflow Web Server

Severity:

HIGH RISK

(8.4)

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

Apache Airflow 2 allows a DAG Author with existing elevated permissions to manipulate internal database entries related to log template history in a way that results in arbitrary code execution within the web-server context.

When a user later views historical task information, the web server may render attacker-controlled template data, enabling remote code execution on the server side.

Affected context

This vulnerability arises in Apache Airflow 2 deployments where:

  • DAG Authors have direct or indirect influence over database content related to log template history,
  • The log template history functionality is enabled, and
  • Historical task information is rendered within the web UI by the web server.

It particularly affects environments where the Airflow web server trusts and processes template-related data from the database without sufficient isolation or validation. In such setups, changes in log template metadata can influence how server-side code paths are evaluated when historical logs are viewed.

Exploit preconditions

  • Attack surface: Airflow web UI and backend processing of historical task log templates.
  • Required access: A legitimate DAG Author role (or equivalent) with the ability to manipulate Airflow's database content related to log templates.
  • Trigger point: A user, which may be the attacker or another operator, viewing historical task information/logs that reference the manipulated template entries.
  • Why exploitation is possible: The web server processes template or log-related data from the database in a way that can lead to dynamic code evaluation. Because this data can be indirectly controlled by a DAG Author, crafted entries can cause server-side code execution when rendered.

Why this happens

The core issue is a code injection pattern where data sourced from the Airflow database is treated as trusted input during server-side rendering of log template history.

Instead of strictly treating template-related database fields as inert data, the implementation allows them to influence or form part of executable code paths or templated expressions in the web server. This reflects CWE-94: Improper Control of Generation of Code ('Code Injection'), where user-controllable content (via a privileged role) is incorporated into dynamically interpreted or evaluated constructs.

The vulnerability is not about basic text display; it stems from combining dynamic template logic with insufficient separation between "data" and "code," allowing an attacker with existing DAG Author privileges to craft database state that the web server later executes.

Potential impact

  • Execution of arbitrary code in the Airflow web server process.
  • Compromise of Airflow web UI session data and application secrets accessible from the web server.
  • Modification, theft, or corruption of DAG definitions and operational metadata.
  • Lateral movement inside the hosting environment, depending on web server permissions and network reach.
  • Disruption of workflow orchestration, including tampering with logs and run histories.

General mitigation guidance

Effective mitigation focuses on eliminating dynamic code evaluation from template-related data flows and tightening privilege and trust boundaries:

  • Treat all template-related entries from the database as untrusted data, ensuring they are never interpreted as executable code or dynamically evaluated expressions.
  • Use a strict templating engine configuration that does not allow arbitrary code execution and isolates template logic from underlying runtime constructs.
  • Separate "template configuration" from "template content," and ensure only predefined, static templates are used for log rendering where possible.
  • Apply least-privilege principles to Airflow roles so operational accounts cannot modify internal structures in ways that affect server-side code paths.
  • Introduce robust validation and sanitization for any database-backed configuration or metadata that influences server rendering logic, rejecting or neutralizing unsafe constructs instead of attempting to interpret them.
  • Prefer secure-by-default feature flags: disable high-risk, dynamically interpreted features unless there is a clear operational need and compensating controls are in place.

How teams detect issues like this

High-level detection typically includes:

  • Static analysis: Scan Airflow customizations, plugins, and extensions for patterns where database fields or user-controlled template values are passed into dynamic evaluation functions, dangerous Jinja features, or any API that compiles or executes code at runtime.
  • Code review signals: Flag areas where:
  • Log templates or history metadata are assembled into code strings or expressions,
  • Database-backed configuration is used as part of template logic,
  • The boundary between configuration data and executable template logic is unclear.
  • Runtime monitoring: Track unusual modifications to log template–related tables or metadata, especially out-of-band changes that do not match normal DAG development workflows.
  • Policy enforcement: Use CI/CD gates and organizational policies to prohibit the introduction of new features that perform runtime code generation from configuration or database content. Automated code review tools can assist by enforcing rules around dangerous evaluation or templating constructs.

Sources

SourceLink
github.comgithub.com/apache/airflow/pull/61880
lists.apache.orglists.apache.org/thread/2vrmrhcht6g7cp5yjxpnrk2wtrncm6cy
openwall.comopenwall.com/lists/oss-security/2026/02/23/3

Frequently asked

questions

Exploitation is constrained to environments where a DAG Author (or similar privileged role) exists and can manipulate the relevant database entries, but within that context it can lead to full code execution in the web server process when affected views are rendered.

No. The attacker primarily needs Airflow-level permissions (such as a DAG Author role) that ultimately allow influence over the log template history in the database; the code execution then occurs when the web server processes that data.

The safest pattern is to fully decouple user- or role-controlled data from any mechanism that can generate or execute code. Log-related templates should be static or strictly validated, and their content must never be fed into dynamic evaluation or powerful template features capable of running arbitrary code.

Avoid any feature that interprets database or configuration data as executable code, enforce defensive configurations in template engines, adopt least-privilege role designs, and establish security reviews for features that introduce dynamic rendering or code generation capabilities in a web server context.

Find out what's already
exploitable in your codebase.