CVE-2021-29612: TensorFlow - Heap Buffer Overflow in BandedTriangularSolve
Summary
CVE-2021-29612: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow across 6 version ranges.
< 0ab290774f91a23bebe30a358fde4e53ab4876a0
< 2.1.4
>= 2.2.0, < 2.2.3
>= 2.3.0, < 2.3.3
>= 2.4.0, < 2.4.2
< ba6822bd7b7324ba201a28b2f278c29a98edbef2
Fixed in 4 releases; the minimum fixed version depends on the release line you run. How to fix ↓
Also tracked for
- tensorflow · Bitnami
- tensorflow-cpu · PyPI
- tensorflow-gpu · PyPI
The same CVE-2021-29612 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
TensorFlow is an end-to-end open source platform for machine learning. It provides a comprehensive ecosystem of tools, libraries, and resources for building and deploying machine learning models. TensorFlow is widely used in various industries and research domains for tasks such as image recognition, natural language processing, and recommendation systems. However, a vulnerability has been discovered in the implementation of tf.raw_ops.BandedTriangularSolve in TensorFlow.
Vulnerability Detail
The vulnerability in TensorFlow's tf.raw_ops.BandedTriangularSolve stems from a heap buffer overflow in the Eigen implementation. The implementation fails to validate that the two input tensors are not empty, leading to the overflow. Additionally, the validation present in the code is ineffective due to a missing check of the ctx->status() value before continuing execution. An attacker can exploit this vulnerability to trigger the heap buffer overflow, potentially leading to arbitrary code execution or a denial of service attack. The issue affects TensorFlow versions 2.1.4 and above.
How To Fix
Latest published version: 2.21.0 as of 22 Oct 2026
pip install --upgrade "tensorflow==2.21.0"
Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.
If you can't move to the latest
The minimum fixed version depends on the release line you run.
-
< 2.1.42.1.4pip install --upgrade "tensorflow==2.1.4" -
>= 2.2.0, < 2.2.32.2.3pip install --upgrade "tensorflow==2.2.3" -
>= 2.3.0, < 2.3.32.3.3pip install --upgrade "tensorflow==2.3.3" -
>= 2.4.0, < 2.4.22.4.2pip install --upgrade "tensorflow==2.4.2"
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
As a temporary workaround, users can disable or restrict access to the affected functionality in their TensorFlow deployment. This can be achieved by modifying the code or configuration to avoid using the vulnerable tf.raw_ops.BandedTriangularSolve operation. However, it is strongly advised to apply the official fix by upgrading to a patched version of TensorFlow as soon as possible.
Conclusion
The vulnerability in TensorFlow's tf.raw_ops.BandedTriangularSolve can be mitigated by upgrading to the latest patched versions of TensorFlow. It is crucial to promptly apply the fix to ensure the security and stability of machine learning deployments. For further support and assistance with vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open source platform for machine learning that provides a comprehensive set of tools and resources for building and deploying machine learning models.
tf.raw_ops.BandedTriangularSolve is an operation in TensorFlow that performs a banded triangular solve using the Eigen library. It is used in various machine learning algorithms and computations.
A heap buffer overflow is a type of vulnerability where a program writes data beyond the allocated buffer in the heap memory. This can lead to memory corruption, crashes, and potentially allow an attacker to execute arbitrary code.
Exploiting this vulnerability can lead to arbitrary code execution or a denial of service attack. An attacker could potentially gain control over the affected TensorFlow deployment or cause it to crash, disrupting machine learning operations.
You can use the Vulert Playground at Vulert Scanner to check if your TensorFlow installation is affected by this vulnerability. Simply provide your Pipfile.lock file, and Vulert will analyze it for any open-source vulnerabilities, including this one.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.