CVE-2021-29584: TensorFlow Integer Overflow Denial of Service
Summary
CVE-2021-29584: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow-cpu across 5 version ranges.
< 2.1.4
>= 2.2.0, < 2.2.3
>= 2.3.0, < 2.3.3
>= 2.4.0, < 2.4.2
< 4c0ee937c0f61c4fc5f5d32d9bb4c67428012a60
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-gpu · PyPI
The same CVE-2021-29584 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 domains, including research, industry, and academia. It supports both CPU and GPU computations, allowing for efficient training and inference on different hardware configurations.
Vulnerability Detail
The vulnerability identified as CVE-2021-29584 in TensorFlow is a denial of service (DoS) issue that can be triggered by an attacker. The vulnerability arises from an integer overflow in constructing a new tensor shape. The implementation of the TensorShape constructor fails to check for overflow when building a dense shape. This oversight can lead to a CHECK failure, resulting in a DoS condition. The vulnerable code can be found in the sparse_split_op.cc file of the TensorFlow source code. The issue affects multiple versions of TensorFlow, including 2.1.4, 2.2.3, 2.3.3, and 2.4.2.
How To Fix
Latest published version: 2.21.0 as of 22 Oct 2026
pip install --upgrade "tensorflow-cpu==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-cpu==2.1.4" -
>= 2.2.0, < 2.2.32.2.3pip install --upgrade "tensorflow-cpu==2.2.3" -
>= 2.3.0, < 2.3.32.3.3pip install --upgrade "tensorflow-cpu==2.3.3" -
>= 2.4.0, < 2.4.22.4.2pip install --upgrade "tensorflow-cpu==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 apply input validation and sanitization techniques to prevent malicious inputs from triggering the vulnerability. It is crucial to ensure that tensor shapes are constructed with valid dimensions and that overflow conditions are properly handled. Here is an example of input validation code that can be used as a workaround:
import tensorflow as tf
def construct_tensor_shape(shape):
if all(dim > 0 for dim in shape):
return tf.TensorShape(shape)
else:
raise ValueError('Invalid tensor shape')
Conclusion
The identified vulnerability in TensorFlow can lead to a denial of service condition when constructing tensor shapes. The TensorFlow development team has addressed the issue and will release patched versions of TensorFlow, including backports for earlier affected versions. Users are advised to update their installations to the latest patched version as soon as it becomes available. Applying input validation and sanitization techniques can serve as a temporary workaround. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow-cpu →
FAQ
TensorFlow is an open source platform for machine learning that provides a comprehensive set of tools and libraries for building and deploying machine learning models.
The vulnerability can be exploited by an attacker to trigger a denial of service condition in TensorFlow, potentially disrupting machine learning processes and causing system instability.
The vulnerability affects TensorFlow versions 2.1.4, 2.2.3, 2.3.3, and 2.4.2. These versions are still within the supported range and will receive the necessary patches.
To fix this vulnerability, it is recommended to update your TensorFlow installation to the latest patched version once it becomes available. Follow the official TensorFlow documentation for instructions on how to update the package.
Yes, you can apply input validation and sanitization techniques to prevent malicious inputs from triggering the vulnerability. Ensure that tensor shapes are constructed with valid dimensions and handle overflow conditions properly.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-cpu.