Summary
Apache Airflow contained an unsafe deserialization flaw where BaseSerialization.deserialize() could import attacker-controlled classes when loading serialized DAGs.
A malicious DAG author could embed a crafted trigger to achieve remote code execution within the Scheduler or API Server processes whenever the DAG is deserialized.
Affected context
The vulnerability arises in Apache Airflow deployments that use serialized DAGs and allow users to submit or modify DAG definitions.
It is most relevant in environments where DAG author code is intended to run only in worker contexts, yet serialized DAGs are parsed by central components such as the Scheduler and API Server.
The risk increases when DAG authors are semi-trusted or untrusted, and when configuration does not restrict the set of classes that may be deserialized.
Exploit preconditions
- Attack surface: Airflow control plane components (Scheduler / API Server) that load serialized DAGs.
- Required access: Ability to create, modify, or upload DAGs that will be serialized and later deserialized by the control plane.
- Trigger point: Deserialization of DAGs via
BaseSerialization.deserialize()during DAG loading, refresh, or processing. - Why exploitation is possible: The deserialization logic allowed unrestricted
import_string()of class paths embedded in serialized DAG data, enabling untrusted DAG authors to cause arbitrary classes or code paths to be imported and executed in processes where their code should never run.
Why this happens
This issue is a classic instance of unsafe deserialization (CWE-502) in a workflow orchestration context.
The BaseSerialization.deserialize() method trusted class identifiers embedded in serialized DAG structures and used import_string() without applying a strict allowlist or validation.
By treating serialized DAG content as authoritative and fully trusted, Airflow blurred the boundary between data and executable logic, allowing untrusted DAG authors to influence which classes are imported and instantiated inside high-privilege components like the Scheduler and API Server.
Potential impact
- Attackers could gain remote code execution within the Airflow Scheduler process.
- Attackers could gain remote code execution within the Airflow API Server process.
- Compromise of the Airflow control plane, including access to DAG metadata and configuration.
- Lateral movement to connected systems through credentials, connections, or hooks managed by Airflow.
- Disruption of scheduled workflows and potential tampering with orchestration logic.
General mitigation guidance
Mitigation typically focuses on tightening deserialization semantics and reinforcing trust boundaries between DAG authors and control-plane components.
Common defensive patterns include:
- Applying strict allowlists for classes that may be deserialized, limiting imports to a small, known-safe subset of Airflow internals.
- Treating serialized DAG data as untrusted input and validating or normalizing it before deserialization, especially when it originates from DAG authors.
- Separating responsibilities so that high-privilege processes avoid executing or importing any DAG-author-controlled code paths.
- Reducing the privileges of control-plane components (Scheduler / API Server) and limiting their access to sensitive resources, following least-privilege principles.
- Establishing governance around DAG author trust levels, ensuring that untrusted or semi-trusted authors cannot submit DAGs that are automatically promoted to production control-plane environments.
How teams detect issues like this
Detection can be approached through both preventative and retrospective techniques:
- Static analysis and code review: Look for deserialization routines that call generic import helpers (such as
import_string()or dynamic__import__) using values derived from serialized or user-controlled data, particularly in DAG serialization/deserialization paths. - Configuration review: Audit Airflow configurations for permissive deserialization settings, such as broad or unset
[core] allowed_deserialization_classes, and flag deployments where DAG authorship is not fully trusted. - Control-plane monitoring: Instrument the Scheduler and API Server to log class loading and dynamic imports during DAG deserialization, alerting on unexpected modules or packages being imported.
- Automated tooling: Use security scanners or custom linting rules integrated into CI/CD pipelines to detect patterns of unsafe deserialization and dynamic imports in orchestrator code and plugins.

