/

CVE-2026-45360

Severity:

HIGH RISK

(7.3)

Unsafe Deserialization (CWE-502) in Apache Airflow Scheduler DeadlineReference Decoder

CVE-2026-45360

Analyzed

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Code Execution in Scheduler Context / Privilege Escalation

Severity:

HIGH RISK

(7.3)

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's scheduler-side deadline-reference decoder (SerializedCustomReference.deserialize_reference) unsafely imported and instantiated arbitrary classes based on DAG-author-controlled serialized state, without an allowlist or registry check.

In deployments where DAG authors are less trusted than the scheduler process, a malicious DAG could embed a crafted DeadlineReference that causes the scheduler to import attacker-controlled code and instantiate it with a live SQLAlchemy session, enabling privileged actions within the scheduler context.

Affected context

This vulnerability occurs in Apache Airflow environments where:

  • The scheduler process can import DAG bundles directly (typical single-host or shared-code deployments).
  • SerializedCustomReference.deserialize_reference is used to handle serialized DeadlineReference objects.
  • DAG authors are not fully trusted to run arbitrary code with the same privileges as the scheduler.

Under these conditions, the scheduler trusts class paths embedded in serialized references and treats them as loadable, instantiable components, effectively extending the scheduler's trusted code surface to any module path reachable from the scheduler's Python environment.

Exploit preconditions

  • Attack surface: Airflow scheduler process handling serialized DAG state and DeadlineReference objects.
  • Required access: Ability to author or modify DAGs whose code and serialized forms are processed by the scheduler (e.g., DAG author permissions, write access to the DAG repository or deployment pipeline).
  • Trigger point: Evaluation of a crafted DeadlineReference during SerializedCustomReference.deserialize_reference, which reads the serialized class path and calls import_string(...) to load and instantiate it.
  • Why exploitation is possible: The decoder:
  • Accepts class paths from serialized DAG state controlled by DAG authors.
  • Performs dynamic imports (import_string) directly from those paths.
  • Instantiates the resulting class with powerful objects (e.g., a live SQLAlchemy session) without an allowlist, plugin registry gate, or trust boundary enforcement.

Why this happens

The core issue is an unsafe deserialization pattern where serialized metadata from a partially untrusted source (DAG-author-controlled state) is treated as executable configuration.

SerializedCustomReference.deserialize_reference interprets serialized DeadlineReference data as a fully trusted specification of what Python class to import and instantiate. Instead of restricting deserialization to a bounded set of known-safe types, it dynamically imports arbitrary module paths and constructs the referenced classes, mapping directly to CWE-502: Deserialization of Untrusted Data.

In abstract terms, the insecure pattern is:

  • Take untrusted or semi-trusted serialized input.
  • Derive a code identifier (module/class path) from that input.
  • Dynamically import and instantiate the referenced type, often with sensitive capabilities (e.g., database sessions, scheduler internals).

This collapses the distinction between data and code, allowing serialized content to influence what code executes inside a high-privilege component (the scheduler).

Potential impact

  • DAG authors may be able to execute arbitrary Python code inside the scheduler process.
  • Attackers could abuse the attached SQLAlchemy session to:
  • Read or modify workflow metadata and state.
  • Alter DAG run history, task status, or scheduling information.
  • Tamper with connections or variables stored in the metadata database.
  • Privilege escalation from "DAG author" role to "scheduler-level" capabilities within the Airflow environment.
  • Potential pivot to other systems via stored credentials or downstream actions initiated by modified scheduling logic.
  • Integrity violations such as schedule manipulation, job suppression, or backdoor insertion into orchestrated workflows.

General mitigation guidance

Effective mitigations focus on constraining deserialization behavior and tightening trust boundaries between DAG authors and the scheduler:

  • Type allowlisting and registries:
  • Restrict dynamic imports to a curated list of approved DeadlineReference implementations.
  • Use a plugin or registry mechanism where only explicitly registered classes can be instantiated.
  • Data–code separation:
  • Treat serialized DAG state as data only and avoid allowing it to specify arbitrary code locations (module/class paths).
  • Encode references using stable identifiers or enum-like keys, resolving them to concrete classes via static mappings in scheduler code.
  • Least-privilege object construction:
  • Limit what sensitive objects (e.g., full SQLAlchemy sessions) are passed into deserialized instances, favoring narrower interfaces or service abstractions.
  • Avoid injecting high-privilege handles into any object whose type is not strongly constrained.
  • Trust boundary enforcement:
  • Design Airflow deployments so that less-trusted DAG author code does not implicitly get the same execution privileges as the scheduler.
  • Use separate environments or review processes for DAG code in multi-tenant deployments.
  • Secure-by-default serialization:
  • Prefer simple, schema-validated data formats for serialized state (primitive types and structured objects) rather than flexible mechanisms that can encode arbitrary types.

How teams detect issues like this

Detection can focus on both code-level patterns and runtime behavior:

  • Static analysis and code scanning:
  • Flag uses of dynamic import functions (import_string, __import__, importlib.import_module, etc.) that are parameterized by serialized or user-controlled input.
  • Identify deserialization paths (deserialize_reference, similar helpers) that:
  • Accept untrusted or semi-trusted data.
  • Directly resolve class/module names from that data.
  • Look for constructors that receive high-privilege objects (like database sessions) from deserialization contexts.
  • Code review signals:
  • Pay special attention to components where:
  • Scheduler or orchestration services instantiate user- or DAG-provided types.
  • Serialized DAG state is interpreted as configuration for dynamic imports.
  • Require explicit review for any new plugin/extension mechanism that uses import paths from data.
  • Policy and tooling:
  • Introduce internal policies banning unchecked dynamic imports from serialized structures.
  • Integrate automated SAST or custom linters into CI pipelines to enforce these policies.
  • Use runtime logging and monitoring to detect unexpected module loads or class instantiations in scheduler processes, particularly from uncommon module namespaces.

Sources

SourceLink
github.comgithub.com/apache/airflow/pull/66737
lists.apache.orglists.apache.org/thread/q227dghjwgfz8xsxrf2pwpz4wk43zm83
openwall.comopenwall.com/lists/oss-security/2026/05/31/12

Frequently asked

questions

It is not a classic unauthenticated remote exploit. Exploitation requires the ability to supply or modify DAG code or serialized DAG state that the scheduler consumes. In many deployments, this corresponds to a DAG author or someone with access to the DAG repository rather than an arbitrary remote user.

An attacker needs the ability to introduce or change DAGs whose code is importable by the scheduler and whose serialized DeadlineReference state can be processed. This is typically equivalent to having DAG author or CI/CD pipeline write access, especially in shared or multi-tenant environments.

The safest pattern is to eliminate unbounded dynamic imports from serialized or user-influenced data. Instead, use a strict allowlist or registry of supported types, keyed by safe identifiers, and instantiate only those known-safe implementations, passing in the minimal required privileges.

To prevent similar problems:

  • Design serialization formats so they carry data only, not code locations.
  • Enforce strong trust boundaries between orchestrators and tenant-provided artifacts (DAGs, plugins, configs).
  • Avoid injecting high-privilege handles into objects produced from partially untrusted inputs.
  • Incorporate security review and automated checks specifically targeting dynamic loading, plugin systems, and deserialization flows in orchestrator and scheduler components.
Find out what's already
exploitable in your codebase.