CVE-2021-41225: TensorFlow Grappler: uninitialized var, local priv-esc
HIGH PoC AVAILABLEA crafted TensorFlow SavedModel lacking a Dequeue node triggers an uninitialized pointer in the Grappler optimizer, enabling local privilege escalation with minimal access requirements. Patch all TensorFlow instances to 2.7.0, 2.6.1, 2.5.2, or 2.4.4—shared GPU training clusters are highest risk due to multi-tenant exposure. Restrict model loading from untrusted sources as an immediate compensating control.
Risk Assessment
CVSS 7.8 HIGH with local attack vector, low complexity, and low privilege requirement creates a realistic exploitation scenario in ML infrastructure. While physical/local access is required, shared GPU clusters and Jupyter notebook environments are common in enterprise ML teams—lateral movement from a compromised ML engineer account could weaponize this. Full CIA impact (C:H/I:H/A:H) means successful exploitation risks training data exposure, model tampering, and host compromise. Not in CISA KEV, suggesting no confirmed in-the-wild exploitation to date.
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, 2.6.1, 2.5.2, or 2.4.4 across all training servers, notebook environments, and serving infrastructure.
-
AUDIT
Inventory all TF deployments including transitive dependencies in ML pipelines (TFX, Keras, TF Serving).
-
RESTRICT
Enforce least-privilege access to training infrastructure and internal model registries—prevent loading models from untrusted sources.
-
VALIDATE
Gate SavedModel ingestion from external or untrusted origins; inspect graph structure before Grappler optimization.
-
DETECT
Monitor for anomalous privilege escalation events on ML training hosts and alert on unexpected process spawning from TF optimizer processes.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2021-41225?
A crafted TensorFlow SavedModel lacking a Dequeue node triggers an uninitialized pointer in the Grappler optimizer, enabling local privilege escalation with minimal access requirements. Patch all TensorFlow instances to 2.7.0, 2.6.1, 2.5.2, or 2.4.4—shared GPU training clusters are highest risk due to multi-tenant exposure. Restrict model loading from untrusted sources as an immediate compensating control.
Is CVE-2021-41225 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2021-41225, increasing the risk of exploitation.
How to fix CVE-2021-41225?
1. PATCH: Upgrade TensorFlow to 2.7.0, 2.6.1, 2.5.2, or 2.4.4 across all training servers, notebook environments, and serving infrastructure. 2. AUDIT: Inventory all TF deployments including transitive dependencies in ML pipelines (TFX, Keras, TF Serving). 3. RESTRICT: Enforce least-privilege access to training infrastructure and internal model registries—prevent loading models from untrusted sources. 4. VALIDATE: Gate SavedModel ingestion from external or untrusted origins; inspect graph structure before Grappler optimization. 5. DETECT: Monitor for anomalous privilege escalation events on ML training hosts and alert on unexpected process spawning from TF optimizer processes.
What systems are affected by CVE-2021-41225?
This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, ML infrastructure, shared GPU clusters, MLOps platforms.
What is the CVSS score for CVE-2021-41225?
CVE-2021-41225 has a CVSS v3.1 base score of 7.8 (HIGH). The EPSS exploitation probability is 0.02%.
Technical Details
NVD Description
TensorFlow is an open source platform for machine learning. In affected versions TensorFlow's Grappler optimizer has a use of unitialized variable. If the `train_nodes` vector (obtained from the saved model that gets optimized) does not contain a `Dequeue` node, then `dequeue_node` is left unitialized. 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 low-privilege access to a shared GPU training cluster crafts a malicious TensorFlow SavedModel whose train_nodes graph intentionally omits a Dequeue node. When a privileged training pipeline or model optimization job loads this artifact through Grappler, the uninitialized dequeue_node pointer is dereferenced, enabling memory corruption that leads to arbitrary code execution or privilege escalation to host root. In multi-tenant ML environments—common in enterprise data science teams—this allows one user's workload to compromise the host or other users' training jobs, potentially exfiltrating model weights, training data, or credentials stored on the system.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H References
- github.com/tensorflow/tensorflow/commit/68867bf01239d9e1048f98cbad185bf4761bedd3 Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-7r94-xv9v-63jw 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