CVE-2021-29529: TensorFlow: heap buffer overflow in quantized image resize
HIGH PoC AVAILABLEUpgrade TensorFlow to 2.5.0 (or 2.4.2/2.3.3/2.2.3/2.1.4) on every system running quantized image processing pipelines. Local exploit with low complexity means a malicious insider or compromised ML worker node can achieve arbitrary code execution within the TensorFlow process. Priority is highest in shared multi-tenant ML environments like Jupyter hubs, MLflow servers, and GPU training clusters.
Risk Assessment
CVSS 7.8 High, but the local-only attack vector prevents direct remote exploitation, limiting realistic exposure. Risk escalates sharply in shared ML compute environments where multiple principals have local access and blast radius expands. Quantized models are standard in edge and optimized inference deployments, broadening the affected surface area. Not in CISA KEV and no confirmed active exploitation, but the vulnerability is fully public with a disclosed PoC in the GitHub advisory.
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 cherrypick to 2.4.2, 2.3.3, 2.2.3, or 2.1.4.
-
Inventory: scan all ML servers, containers, and CI/CD pipelines for vulnerable TensorFlow versions using 'pip show tensorflow' or OCI image scanning.
-
Isolate: in multi-tenant environments, enforce container/VM-level isolation so TF processes cannot cross trust boundaries.
-
Restrict: limit direct access to raw TF ops APIs in multi-tenant inference services; prefer high-level Keras APIs that validate inputs.
-
Detect: alert on unexpected memory errors (SIGSEGV, heap corruption logs) from TF serving processes as potential exploit indicators.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2021-29529?
Upgrade TensorFlow to 2.5.0 (or 2.4.2/2.3.3/2.2.3/2.1.4) on every system running quantized image processing pipelines. Local exploit with low complexity means a malicious insider or compromised ML worker node can achieve arbitrary code execution within the TensorFlow process. Priority is highest in shared multi-tenant ML environments like Jupyter hubs, MLflow servers, and GPU training clusters.
Is CVE-2021-29529 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2021-29529, increasing the risk of exploitation.
How to fix CVE-2021-29529?
1. Patch: upgrade to TensorFlow >=2.5.0 or apply cherrypick to 2.4.2, 2.3.3, 2.2.3, or 2.1.4. 2. Inventory: scan all ML servers, containers, and CI/CD pipelines for vulnerable TensorFlow versions using 'pip show tensorflow' or OCI image scanning. 3. Isolate: in multi-tenant environments, enforce container/VM-level isolation so TF processes cannot cross trust boundaries. 4. Restrict: limit direct access to raw TF ops APIs in multi-tenant inference services; prefer high-level Keras APIs that validate inputs. 5. Detect: alert on unexpected memory errors (SIGSEGV, heap corruption logs) from TF serving processes as potential exploit indicators.
What systems are affected by CVE-2021-29529?
This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, edge/mobile inference, image preprocessing pipelines.
What is the CVSS score for CVE-2021-29529?
CVE-2021-29529 has a CVSS v3.1 base score of 7.8 (HIGH). The EPSS exploitation probability is 0.03%.
Technical Details
NVD Description
TensorFlow is an end-to-end open source platform for machine learning. An attacker can trigger a heap buffer overflow in `tf.raw_ops.QuantizedResizeBilinear` by manipulating input values so that float rounding results in off-by-one error in accessing image elements. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/44b7f486c0143f68b56c34e2d01e146ee445134a/tensorflow/core/kernels/quantized_resize_bilinear_op.cc#L62-L66) computes two integers (representing the upper and lower bounds for interpolation) by ceiling and flooring a floating point value. For some values of `in`, `interpolation->upper[i]` might be smaller than `interpolation->lower[i]`. This is an issue if `interpolation->upper[i]` is capped at `in_size-1` as it means that `interpolation->lower[i]` points outside of the image. Then, in the interpolation code(https://github.com/tensorflow/tensorflow/blob/44b7f486c0143f68b56c34e2d01e146ee445134a/tensorflow/core/kernels/quantized_resize_bilinear_op.cc#L245-L264), this would result in heap buffer overflow. 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 attacker with local access to a shared ML inference server or GPU training cluster constructs a crafted image batch where specific floating-point pixel coordinate values cause ceiling and floor interpolation bounds to invert after rounding. When fed to a quantized computer vision model using QuantizedResizeBilinear in its preprocessing graph, this triggers a heap buffer read/write out of bounds. In a Kubeflow or MLflow multi-tenant environment, the attacker escalates from a low-privilege notebook session to code execution in the inference process, potentially accessing other tenants' model weights, API keys stored as environment variables, or the underlying host via container escape primitives.
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/f851613f8f0fb0c838d160ced13c134f778e3ce7 Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-jfp7-4j67-8r3q Exploit Patch 3rd Party
- github.com/aryanxsh/example-vulnerable-repo Exploit
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