CVE-2021-41217: TensorFlow: null pointer crash in control flow graph
MEDIUM PoC AVAILABLEA crafted TensorFlow model with unpaired control flow nodes (Exit without Enter) crashes the TF runtime via null pointer dereference, causing denial of service. Any pipeline that loads externally-supplied or user-submitted TF models is at risk. Patch immediately to TF 2.7.0, 2.6.1, 2.5.2, or 2.4.4 — and validate model provenance before loading.
Risk Assessment
Medium risk in isolated environments, elevated in shared ML platforms. The local attack vector (AV:L) limits direct remote exploitation, but in multi-tenant training platforms, model-sharing hubs, or CI/CD pipelines that auto-load submitted models, an attacker with model upload capability can reliably crash the TF worker process. No confidentiality or integrity impact — pure availability loss. CVSS 5.5 underestimates operational impact in production inference fleets.
Affected Systems
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| tensorflow | pip | — | No patch |
Do you use tensorflow? You're affected.
Severity & Risk
Attack Surface
Recommended Action
5 steps-
Patch: Upgrade TensorFlow to 2.7.0 (preferred), or cherrypick patches for 2.6.1, 2.5.2, 2.4.4.
-
Validate model provenance: Restrict model loading to trusted, hash-verified sources; reject models from untrusted submitters.
-
Sandbox model loading: Run model parsing in isolated subprocesses with resource limits so a crash does not cascade.
-
Detect: Alert on unexpected TF process terminations (SIGSEGV/crash signals) — repeated crashes may indicate active exploitation attempts.
-
Audit: Check ML pipeline dependencies; CI/CD jobs that auto-test submitted models are particularly exposed.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2021-41217?
A crafted TensorFlow model with unpaired control flow nodes (Exit without Enter) crashes the TF runtime via null pointer dereference, causing denial of service. Any pipeline that loads externally-supplied or user-submitted TF models is at risk. Patch immediately to TF 2.7.0, 2.6.1, 2.5.2, or 2.4.4 — and validate model provenance before loading.
Is CVE-2021-41217 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2021-41217, increasing the risk of exploitation.
How to fix CVE-2021-41217?
1. Patch: Upgrade TensorFlow to 2.7.0 (preferred), or cherrypick patches for 2.6.1, 2.5.2, 2.4.4. 2. Validate model provenance: Restrict model loading to trusted, hash-verified sources; reject models from untrusted submitters. 3. Sandbox model loading: Run model parsing in isolated subprocesses with resource limits so a crash does not cascade. 4. Detect: Alert on unexpected TF process terminations (SIGSEGV/crash signals) — repeated crashes may indicate active exploitation attempts. 5. Audit: Check ML pipeline dependencies; CI/CD jobs that auto-test submitted models are particularly exposed.
What systems are affected by CVE-2021-41217?
This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, model registries, MLOps pipelines, batch inference.
What is the CVSS score for CVE-2021-41217?
CVE-2021-41217 has a CVSS v3.1 base score of 5.5 (MEDIUM). The EPSS exploitation probability is 0.02%.
Technical Details
NVD Description
TensorFlow is an open source platform for machine learning. In affected versions the process of building the control flow graph for a TensorFlow model is vulnerable to a null pointer exception when nodes that should be paired are not. This occurs because the code assumes that the first node in the pairing (e.g., an `Enter` node) always exists when encountering the second node (e.g., an `Exit` node). When this is not the case, `parent` is `nullptr` so dereferencing it causes a crash. The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, TensorFlow 2.5.2, and TensorFlow 2.4.4, as these are also affected and still in supported range.
Exploitation Scenario
An adversary with access to a model-sharing platform (e.g., internal MLflow registry, shared training cluster, or public model hub) uploads a crafted SavedModel containing an Exit node in a control flow subgraph without the required paired Enter node. When any user or automated pipeline loads this model — during training, fine-tuning, or serving — TensorFlow's graph builder hits a null pointer dereference and crashes the worker. In a training cluster, this can disrupt long-running jobs. In a model serving fleet, it crashes the inference process, triggering restarts that degrade availability. Exploitation requires only the ability to craft and submit a TF model file — no exploit code beyond a few lines of TF graph manipulation API.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H References
- github.com/tensorflow/tensorflow/commit/05cbebd3c6bb8f517a158b0155debb8df79017ff Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-5crj-c72x-m7gq Exploit Patch 3rd Party
Timeline
Related Vulnerabilities
CVE-2020-15196 9.9 TensorFlow: heap OOB read in sparse/ragged count ops
Same package: tensorflow CVE-2020-15205 9.8 TensorFlow: heap overflow in StringNGrams, ASLR bypass
Same package: tensorflow CVE-2020-15208 9.8 TFLite: OOB read/write via tensor dimension mismatch
Same package: tensorflow CVE-2019-16778 9.8 TensorFlow: heap overflow in UnsortedSegmentSum op
Same package: tensorflow CVE-2022-23587 9.8 TensorFlow: integer overflow in Grappler enables RCE
Same package: tensorflow
AI Threat Alert