CVE-2021-29555: Denial of Service in TensorFlow
Summary
CVE-2021-29555: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow-cpu across 5 version ranges.
< 1a2a87229d1d61e23a39373777c056161eb4084d
< 2.1.4
>= 2.2.0, < 2.2.3
>= 2.3.0, < 2.3.3
>= 2.4.0, < 2.4.2
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-29555 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 is widely used in various domains, including research, industry, and academia. It allows users to build and train machine learning models using high-level APIs and provides efficient implementations of various algorithms and operations. However, a vulnerability has been discovered in TensorFlow that can lead to a denial of service attack.
Vulnerability Detail
The vulnerability (CVE-2021-29555) in TensorFlow is caused by a runtime error in the tf.raw_ops.FusedBatchNorm function. The implementation of this function performs a division based on the last dimension of the x tensor, which is controlled by the user. An attacker can exploit this by providing a malicious input that triggers a runtime error, leading to a denial of service. This vulnerability affects versions of TensorFlow up to 2.4.2, as well as versions 2.1.4, 2.2.3, and 2.3.3. The impact of this vulnerability can be significant, as it can disrupt the availability of TensorFlow-based machine learning systems.
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 temporary workaround, users can implement input validation and sanitization to mitigate the risk of this vulnerability. By carefully validating and sanitizing user inputs before passing them to the tf.raw_ops.FusedBatchNorm function, the likelihood of triggering the runtime error can be reduced. Here is an example of input validation in Python:
import tensorflow as tf
def validate_input(x):
if len(x.shape) < 2:
raise ValueError('Input tensor must have at least 2 dimensions')
# Additional validation logic...
return x
x = validate_input(x)
# Call to tf.raw_ops.FusedBatchNorm with validated input
Conclusion
In conclusion, the vulnerability (CVE-2021-29555) in TensorFlow can lead to a denial of service attack. Users are advised to update to the latest patched versions and regularly check for updates. Implementing input validation and sanitization can also help mitigate the risk. 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 tools and libraries for building and training machine learning models.
This vulnerability can lead to a denial of service attack, potentially disrupting the availability of TensorFlow-based machine learning systems.
Versions up to 2.4.2, as well as versions 2.1.4, 2.2.3, and 2.3.3, are affected by this vulnerability.
The fix for this vulnerability will be included in TensorFlow 2.5.0. In the meantime, users should update to the latest patched versions (2.4.2, 2.3.3, 2.2.3, and 2.1.4) and regularly check for updates.
Yes, as a temporary workaround, users can implement input validation and sanitization to reduce the risk of triggering the vulnerability. Carefully validate and sanitize user inputs before passing them to the affected function.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-cpu.