CVE-2021-29610: TensorFlow: heap R/W via quantization axis underflow
HIGH PoC AVAILABLEA logic flaw in TensorFlow's QuantizeAndDequantizeV2 op allows negative axis values to bypass validation, enabling heap read/write with local low-privilege access. Patch immediately to TF 2.5.0 or the respective backport (2.4.2, 2.3.3, 2.2.3, 2.1.4) for any deployment running quantized models. Risk is bounded by the local attack vector but insider threats and compromised ML environments make this exploitable in real pipelines.
Risk Assessment
Medium-high operational risk for shared ML environments. CVSS 7.8 (High) with local/low-complexity attack vector limits external exposure but lateral movement and insider scenarios remain realistic. Heap underflow yielding full C/I/A impact could enable memory disclosure or code execution within ML serving or training infrastructure. Not in CISA KEV and no evidence of active exploitation in the wild, but unpatched TensorFlow deployments remain a target of opportunity — especially in multi-tenant notebook environments.
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 to TensorFlow 2.5.0 or apply backports 2.4.2 / 2.3.3 / 2.2.3 / 2.1.4.
-
Audit all TF deployments for version compliance — prioritize internet-accessible inference endpoints and shared training environments.
-
Restrict execution of untrusted TF graphs and model files in shared platforms.
-
Container isolation: run TF workloads in sandboxed containers with minimal privileges to limit heap exploitation blast radius.
-
If observability exists, flag any QuantizeAndDequantizeV2 calls with axis < -1 in op telemetry.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2021-29610?
A logic flaw in TensorFlow's QuantizeAndDequantizeV2 op allows negative axis values to bypass validation, enabling heap read/write with local low-privilege access. Patch immediately to TF 2.5.0 or the respective backport (2.4.2, 2.3.3, 2.2.3, 2.1.4) for any deployment running quantized models. Risk is bounded by the local attack vector but insider threats and compromised ML environments make this exploitable in real pipelines.
Is CVE-2021-29610 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2021-29610, increasing the risk of exploitation.
How to fix CVE-2021-29610?
1. Patch: Upgrade to TensorFlow 2.5.0 or apply backports 2.4.2 / 2.3.3 / 2.2.3 / 2.1.4. 2. Audit all TF deployments for version compliance — prioritize internet-accessible inference endpoints and shared training environments. 3. Restrict execution of untrusted TF graphs and model files in shared platforms. 4. Container isolation: run TF workloads in sandboxed containers with minimal privileges to limit heap exploitation blast radius. 5. If observability exists, flag any QuantizeAndDequantizeV2 calls with axis < -1 in op telemetry.
What systems are affected by CVE-2021-29610?
This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, edge inference, quantization-aware training, multi-tenant ML platforms.
What is the CVSS score for CVE-2021-29610?
CVE-2021-29610 has a CVSS v3.1 base score of 7.8 (HIGH). The EPSS exploitation probability is 0.01%.
Technical Details
NVD Description
TensorFlow is an end-to-end open source platform for machine learning. The validation in `tf.raw_ops.QuantizeAndDequantizeV2` allows invalid values for `axis` argument:. The validation(https://github.com/tensorflow/tensorflow/blob/eccb7ec454e6617738554a255d77f08e60ee0808/tensorflow/core/kernels/quantize_and_dequantize_op.cc#L74-L77) uses `||` to mix two different conditions. If `axis_ < -1` the condition in `OP_REQUIRES` will still be true, but this value of `axis_` results in heap underflow. This allows attackers to read/write to other data on the heap. The fix will be included in TensorFlow 2.5.0. We will also cherrypick this commit on TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3 and TensorFlow 2.1.4, as these are also affected and still in supported range.
Exploitation Scenario
An adversary with local access — a compromised data scientist workstation or a shared Jupyter environment — crafts a TensorFlow script invoking QuantizeAndDequantizeV2 with axis=-2 or lower. The OR-logic validation bug (using || instead of &&) allows this to pass the OP_REQUIRES check. TF then performs pointer arithmetic resulting in a heap underflow, granting the attacker a read/write primitive against adjacent heap memory. From there, they can extract sensitive data (credentials, model weights, training PII) or corrupt adjacent heap objects to escalate privileges. In a multi-tenant ML platform, a low-privileged user could target another user's process memory through this primitive.
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/c5b0d5f8ac19888e46ca14b0e27562e7fbbee9a9 Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-mq5c-prh3-3f3h 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