CVE-2021-29612: TensorFlow-GPU - Heap Buffer Overflow in BandedTriangularSolve
Summary
CVE-2021-29612: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow-gpu 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 · PyPI
- tensorflow · PyPI
- tensorflow-cpu · 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 developing and deploying machine learning models. TensorFlow-GPU is a variant of TensorFlow that leverages the power of GPUs for accelerated computation. It is widely used in various industries and research domains for training and inference of deep learning models.
Vulnerability Detail
A heap buffer overflow vulnerability exists in the Eigen implementation of tf.raw_ops.BandedTriangularSolve in TensorFlow-GPU. The vulnerability arises due to the lack of proper input validation in the implementation. The affected code fails to validate that the two input tensors are not empty, leading to a heap buffer overflow when processing the input. An attacker can exploit this vulnerability by providing specially crafted input tensors, potentially resulting in arbitrary code execution or a denial of service condition. The vulnerability affects versions of TensorFlow-GPU ranging from 0 to 2.1.4, 2.2.0 to 2.2.3, 2.3.0 to 2.3.3, and 2.4.0 to 2.4.2.
How To Fix
Latest published version: 2.12.0 as of 22 Oct 2026
pip install --upgrade "tensorflow-gpu==2.12.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-gpu==2.1.4" -
>= 2.2.0, < 2.2.32.2.3pip install --upgrade "tensorflow-gpu==2.2.3" -
>= 2.3.0, < 2.3.32.3.3pip install --upgrade "tensorflow-gpu==2.3.3" -
>= 2.4.0, < 2.4.22.4.2pip install --upgrade "tensorflow-gpu==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 workaround, users can temporarily avoid the vulnerability by ensuring that the input tensors provided to tf.raw_ops.BandedTriangularSolve are not empty. This can be achieved by adding appropriate checks in the calling code to validate the input tensors before passing them to the vulnerable function. Here is an example of how to perform the input validation:
import tensorflow as tf
def banded_triangular_solve_wrapper(input_tensor1, input_tensor2):
if input_tensor1.size == 0 or input_tensor2.size == 0:
raise ValueError('Input tensors cannot be empty')
return tf.raw_ops.BandedTriangularSolve(input_tensor1, input_tensor2)
By incorporating this validation check, the vulnerability can be mitigated until a proper fix is applied.
Conclusion
The heap buffer overflow vulnerability in TensorFlow-GPU's tf.raw_ops.BandedTriangularSolve can be mitigated by updating to version 2.5.0 or later. In the meantime, users can apply a temporary workaround by validating the input tensors. For further assistance or support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow-gpu →
FAQ
TensorFlow-GPU is a variant of TensorFlow that utilizes the power of GPUs for accelerated computation. It is widely used for training and inference of deep learning models.
This vulnerability allows an attacker to trigger a heap buffer overflow in TensorFlow-GPU, potentially leading to arbitrary code execution or a denial of service condition.
The vulnerability affects versions of TensorFlow-GPU ranging from 0 to 2.1.4, 2.2.0 to 2.2.3, 2.3.0 to 2.3.3, and 2.4.0 to 2.4.2.
To fix this vulnerability, it is recommended to update TensorFlow-GPU to version 2.5.0 or later. Follow the official upgrade instructions provided by the TensorFlow project.
Yes, a temporary workaround is to ensure that the input tensors provided to tf.raw_ops.BandedTriangularSolve are not empty. Add appropriate input validation checks in the calling code to mitigate the vulnerability.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-gpu.