CVE-2021-41205: TensorFlow: heap OOB read in quantize ops, DoS+leak
HIGH PoC AVAILABLEAny TensorFlow deployment using quantized models (INT8, edge/mobile) on versions prior to 2.7.0/2.6.1/2.5.2/2.4.4 is vulnerable to heap out-of-bounds reads via malformed shape inference inputs. In multi-tenant ML platforms or shared Jupyter environments, a low-privileged user can crash the TF process or extract heap memory. Patch immediately; this is a trivial crash for anyone who can submit computation graphs.
Risk Assessment
CVSS 7.1 (High) with local attack vector and low privilege requirement makes this high severity for shared ML infrastructure. Single-user local installations carry limited exposure, but multi-tenant training platforms, MLflow/Kubeflow environments, and notebook servers where users submit arbitrary graphs face meaningful risk. Not in CISA KEV and no confirmed in-the-wild exploitation, but the low complexity and no-interaction-required profile make it attractive for insider threat or compromised pipeline scenarios.
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, or apply cherrypick to 2.6.1, 2.5.2, or 2.4.4.
-
Audit: Identify all environments running QuantizeAndDequantize* ops with untrusted or user-supplied graph inputs.
-
Isolation: In multi-tenant platforms, sandbox graph execution (separate processes/containers per user) to contain blast radius.
-
Detection: Monitor for TF process crashes or segfaults originating from shape_inference paths; log inputs to quantize ops for anomaly detection.
-
Validation: Add shape validation gates before passing tensors to quantization ops as a defense-in-depth measure.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2021-41205?
Any TensorFlow deployment using quantized models (INT8, edge/mobile) on versions prior to 2.7.0/2.6.1/2.5.2/2.4.4 is vulnerable to heap out-of-bounds reads via malformed shape inference inputs. In multi-tenant ML platforms or shared Jupyter environments, a low-privileged user can crash the TF process or extract heap memory. Patch immediately; this is a trivial crash for anyone who can submit computation graphs.
Is CVE-2021-41205 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2021-41205, increasing the risk of exploitation.
How to fix CVE-2021-41205?
1. Patch: Upgrade TensorFlow to 2.7.0, or apply cherrypick to 2.6.1, 2.5.2, or 2.4.4. 2. Audit: Identify all environments running QuantizeAndDequantize* ops with untrusted or user-supplied graph inputs. 3. Isolation: In multi-tenant platforms, sandbox graph execution (separate processes/containers per user) to contain blast radius. 4. Detection: Monitor for TF process crashes or segfaults originating from shape_inference paths; log inputs to quantize ops for anomaly detection. 5. Validation: Add shape validation gates before passing tensors to quantization ops as a defense-in-depth measure.
What systems are affected by CVE-2021-41205?
This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, model compression pipelines, multi-tenant ML platforms.
What is the CVSS score for CVE-2021-41205?
CVE-2021-41205 has a CVSS v3.1 base score of 7.1 (HIGH). The EPSS exploitation probability is 0.02%.
Technical Details
NVD Description
TensorFlow is an open source platform for machine learning. In affected versions the shape inference functions for the `QuantizeAndDequantizeV*` operations can trigger a read outside of bounds of heap allocated array. 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 attacker with low-privilege access to a shared ML training cluster submits a TensorFlow computation graph containing a QuantizeAndDequantizeV2 op with deliberately malformed shape metadata. During graph execution, the shape inference function reads beyond the allocated heap buffer. In a DoS scenario, this crashes the TF worker process, disrupting training jobs for all users. In an information disclosure scenario, the out-of-bounds read returns heap data from adjacent allocations, potentially leaking model parameters, API keys stored in memory, or other tenant data — relevant in SaaS platforms that process multiple customers' models in shared environments.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H References
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