Summary
Apache Airflow's Task SDK reconstructs callback objects from serialized task data by re-running a constructor that imports the module named in a stored callback path. A DAG author who can control a task instance's next_kwargs may cause an arbitrary module to be imported in the scheduler process when the awaiting_input timeout sweep deserializes that data.
Affected context
The vulnerability affects Apache Airflow deployments using versions in which the scheduler's awaiting_input timeout sweep processes serialized task data and the Task SDK rebuilds Callback objects. It becomes relevant when a DAG author can control a task instance's next_kwargs through the task execution API; the scheduler then deserializes that value during its unconditional timeout sweep. The default deserialization class allow-list does not prevent this path because SyncCallback is recognized as an Airflow class.
Exploit preconditions
- Attack surface: Airflow task execution and scheduler deserialization
- Required access: Ability to author a DAG and control a task instance's
next_kwargsthrough the task execution API - Trigger point: The scheduler's
awaiting_inputtimeout sweep - Required configuration: No non-default configuration is required because the sweep runs unconditionally
- Why exploitation is possible: Reconstructing the callback re-runs a constructor that imports the module identified by serialized callback data, while the relevant callback class passes the configured allow-list
Why this happens
The underlying bug is an unsafe deserialization design in which serialized callback data is treated as sufficient authority to reconstruct an object. Re-running a constructor during deserialization permits attacker-influenced module paths to reach dynamic import behavior before the data has been reduced to a tightly validated representation. This maps to CWE-502: Deserialization of Untrusted Data. Relying on a broad class allow-list is insufficient when an allowed class performs imports based on serialized fields.
Potential impact
- An attacker may cause arbitrary modules to be imported in the scheduler process.
- Imported module initialization code could run with the scheduler's privileges.
- The scheduler's confidentiality, integrity, or availability could be affected.
- A compromised scheduler process could enable further access to Airflow-managed resources.
General mitigation guidance
Mitigation generally focuses on removing executable behavior from deserialization and reducing trust in task-controlled fields.
Common defensive patterns include:
- Deserialize callback data into inert, schema-validated records rather than reconstructing executable objects.
- Resolve callback implementations from server-controlled identifiers instead of attacker-influenced module paths.
- Keep constructors and deserialization hooks free of dynamic imports and other side effects.
- Apply strict field, type, and value validation before any callback resolution occurs.
- Run scheduler components with least privilege and isolate access to credentials, metadata, and worker resources.
- Treat deserialization allow-lists as a defense-in-depth control rather than a substitute for non-executable parsing.
How teams detect issues like this
Detection can combine static analysis, code review, runtime telemetry, and policy enforcement:
- Search for deserialization code that re-runs constructors or resolves imports from serialized fields.
- Review callback reconstruction paths for module-path, class-name, or plugin resolution driven by task data.
- Flag deserialization allow-lists that permit classes with import, execution, or other side-effecting behavior.
- Monitor scheduler processes for unexpected module loads, filesystem access, or child-process activity during timeout processing.
- Enforce CI policies requiring inert schemas and approved registries for callback or plugin resolution.
- Automated code review tools may help identify dynamic imports and unsafe object reconstruction patterns.

