CVE-2021-41211: TensorFlow: heap OOB read in QuantizeV2 shape inference
HIGH PoC AVAILABLEAny TensorFlow deployment on 2.6.0 or earlier running quantization workflows is exposed to a heap out-of-bounds read that can leak memory contents or crash processes. Patch to TensorFlow 2.7.0 or 2.6.1 immediately — this is straightforward with no workaround available. In shared GPU/TPU training clusters, this is a lateral-movement risk if jobs from different tenants coexist.
Risk Assessment
CVSS 7.1 High. Local attack vector with low complexity and low privileges limits internet-facing exposure, but shared ML training infrastructure (Kubernetes GPU clusters, Jupyter hubs, MLflow-managed compute) dramatically widens the blast radius. An insider or compromised CI/CD job can trigger this with a single crafted TensorFlow script. Confidentiality impact is high — heap OOB reads on ML systems can expose model weights, training data batches, or API keys loaded into process memory.
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 2.6.1 — the fix validates axis bounds before heap access.
-
Inventory: Identify all services using TensorFlow quantization (QuantizeV2, quantize_and_dequantize ops) in training and serving pipelines.
-
Isolate: In multi-tenant ML platforms, ensure training jobs run in separate namespaces/pods with restricted inter-process memory access.
-
Detect: Monitor for TensorFlow SIGABRT/segfault crashes in training workers — repeated crashes on quantization ops are a signal.
-
CI/CD: Add TensorFlow version pinning checks in dependency scanning (Snyk, Dependabot) to catch this class of library vulnerability at build time.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2021-41211?
Any TensorFlow deployment on 2.6.0 or earlier running quantization workflows is exposed to a heap out-of-bounds read that can leak memory contents or crash processes. Patch to TensorFlow 2.7.0 or 2.6.1 immediately — this is straightforward with no workaround available. In shared GPU/TPU training clusters, this is a lateral-movement risk if jobs from different tenants coexist.
Is CVE-2021-41211 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2021-41211, increasing the risk of exploitation.
How to fix CVE-2021-41211?
1. Patch: Upgrade TensorFlow to 2.7.0 or 2.6.1 — the fix validates axis bounds before heap access. 2. Inventory: Identify all services using TensorFlow quantization (QuantizeV2, quantize_and_dequantize ops) in training and serving pipelines. 3. Isolate: In multi-tenant ML platforms, ensure training jobs run in separate namespaces/pods with restricted inter-process memory access. 4. Detect: Monitor for TensorFlow SIGABRT/segfault crashes in training workers — repeated crashes on quantization ops are a signal. 5. CI/CD: Add TensorFlow version pinning checks in dependency scanning (Snyk, Dependabot) to catch this class of library vulnerability at build time.
What systems are affected by CVE-2021-41211?
This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, model compression workflows.
What is the CVSS score for CVE-2021-41211?
CVE-2021-41211 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 code for `QuantizeV2` can trigger a read outside of bounds of heap allocated array. This occurs whenever `axis` is a negative value less than `-1`. In this case, we are accessing data before the start of a heap buffer. The code allows `axis` to be an optional argument (`s` would contain an `error::NOT_FOUND` error code). Otherwise, it assumes that `axis` is a valid index into the dimensions of the `input` tensor. If `axis` is less than `-1` then this results in a heap OOB read. The fix will be included in TensorFlow 2.7.0. We will also cherrypick this commit on TensorFlow 2.6.1, as this version is the only one that is also affected.
Exploitation Scenario
An attacker with access to a shared ML training platform (e.g., via a compromised service account or insider threat) submits a training job containing a TensorFlow graph that calls QuantizeV2 with axis set to -2 or lower. The shape inference code reads memory before the start of the heap-allocated dimensions array. Depending on heap layout, this leaks adjacent heap contents — potentially including model weights from another tenant's job, environment variables with API keys, or training batch data. The attacker extracts this via TensorFlow's own logging/output channels without triggering obvious network-based detections.
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