CVE-2021-29537: TensorFlow: heap overflow in QuantizedResizeBilinear op
HIGH PoC AVAILABLEAny TensorFlow deployment running quantized image processing ops on versions prior to 2.5.0 (or the backport releases) is at risk of heap buffer overflow, potentially leading to code execution within the TF process. Patch immediately to TF 2.5.0, 2.4.2, 2.3.3, 2.2.3, or 2.1.4 depending on your pinned version. While the local attack vector limits remote exposure, shared ML infrastructure (Jupyter clusters, multi-tenant GPU nodes, model serving APIs) significantly elevates practical risk.
What is the risk?
CVSS 7.8 High with local attack vector, low complexity, and low privileges required. In isolated single-user environments risk is moderate, but most enterprise ML infrastructure is multi-tenant: shared Jupyter notebooks, Kubeflow pipelines, and TF Serving deployments expose this to a wider attacker surface. Any authenticated user on a shared ML platform who can submit TF graph operations can trigger this. No active exploitation or KEV listing, but the exploit primitive (heap overflow with controlled data) is attractive for privilege escalation in multi-user GPU clusters.
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| TensorFlow | pip | — | No patch |
Do you use TensorFlow? You're affected.
How severe is it?
What is the attack surface?
What should I do?
1 step-
1) Patch: upgrade to TF 2.5.0 or apply backports to 2.4.2 / 2.3.3 / 2.2.3 / 2.1.4. Verify with
pip show tensorflow. 2) Validate quantization thresholds (min/max scalars) before passing to QuantizedResizeBilinear — both must be scalar tensors with finite float values. 3) In TF Serving deployments, enforce input shape and dtype validation at the serving layer to reject malformed quantization parameters before they reach the kernel. 4) Audit multi-tenant Jupyter/Kubeflow environments for unpinned TF versions. 5) Detection: monitor for SIGSEGV/heap corruption signals in TF worker processes, unusual coredumps from model serving pods.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2021-29537?
Any TensorFlow deployment running quantized image processing ops on versions prior to 2.5.0 (or the backport releases) is at risk of heap buffer overflow, potentially leading to code execution within the TF process. Patch immediately to TF 2.5.0, 2.4.2, 2.3.3, 2.2.3, or 2.1.4 depending on your pinned version. While the local attack vector limits remote exposure, shared ML infrastructure (Jupyter clusters, multi-tenant GPU nodes, model serving APIs) significantly elevates practical risk.
Is CVE-2021-29537 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2021-29537, increasing the risk of exploitation.
How to fix CVE-2021-29537?
1) Patch: upgrade to TF 2.5.0 or apply backports to 2.4.2 / 2.3.3 / 2.2.3 / 2.1.4. Verify with `pip show tensorflow`. 2) Validate quantization thresholds (min/max scalars) before passing to QuantizedResizeBilinear — both must be scalar tensors with finite float values. 3) In TF Serving deployments, enforce input shape and dtype validation at the serving layer to reject malformed quantization parameters before they reach the kernel. 4) Audit multi-tenant Jupyter/Kubeflow environments for unpinned TF versions. 5) Detection: monitor for SIGSEGV/heap corruption signals in TF worker processes, unusual coredumps from model serving pods.
What systems are affected by CVE-2021-29537?
This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, inference optimization pipelines, edge/mobile model deployment, multi-tenant ML platforms.
What is the CVSS score for CVE-2021-29537?
CVE-2021-29537 has a CVSS v3.1 base score of 7.8 (HIGH). The EPSS exploitation probability is 0.21%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.001 AI Software AML.T0043.003 Manual Modification AML.T0049 Exploit Public-Facing Application Compliance Controls Affected
What are the technical details?
Original Advisory
TensorFlow is an end-to-end open source platform for machine learning. An attacker can cause a heap buffer overflow in `QuantizedResizeBilinear` by passing in invalid thresholds for the quantization. This is because the implementation(https://github.com/tensorflow/tensorflow/blob/50711818d2e61ccce012591eeb4fdf93a8496726/tensorflow/core/kernels/quantized_resize_bilinear_op.cc#L705-L706) assumes that the 2 arguments are always valid scalars and tries to access the numeric value directly. 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 low-privileged access to a shared ML platform (e.g., a data scientist account on a Kubeflow cluster, or a shared Jupyter notebook server) crafts a TF graph operation invoking QuantizedResizeBilinear with malformed quantization min/max threshold tensors (e.g., non-scalar tensors or tensors with invalid shapes). When the graph executes, the kernel reads quantization thresholds without bounds checking, triggering a heap buffer overflow. In a multi-tenant GPU node, this could be used to corrupt adjacent memory regions, potentially escalating to code execution within the TF process and enabling lateral movement to access other tenants' model weights, training data, or API credentials stored in the same environment.
Weaknesses (CWE)
CWE-787 — Out-of-bounds Write: The product writes data past the end, or before the beginning, of the intended buffer.
- [Requirements] Use a language that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. For example, many languages that perform their own memory management, such as Java and Perl, are not subject to buffer overflows. Other languages, such as Ada and C#, typically provide overflow protection, but the protection can be disabled by the programmer. Be wary that a language's interface to native code may still be subject to overflows, even if the language itself is theoretically safe.
- [Architecture and Design] Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. Examples include the Safe C String Library (SafeStr) by Messier and Viega [REF-57], and the Strsafe.h library from Microsoft [REF-56]. These libraries provide safer versions of overflow-prone string-handling functions.
Source: MITRE CWE corpus.
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/f6c40f0c6cbf00d46c7717a26419f2062f2f8694 Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-8c89-2vwr-chcq 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