CVE-2021-29547: TensorFlow - Out-of-Bounds Access in QuantizedBatchNormWithGlobalNormalization
Summary
CVE-2021-29547: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow across 5 version ranges.
>= 2.2.0, < 2.3.0rc0
< 2.2.0rc0
>= 2.3.0, < 2.3.4
>= 2.4.0, < 2.4.3
< d6ed5bcfe1dcab9e85a4d39931bd18d99018e75b
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-29547 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 offers support for both CPU and GPU computations, making it suitable for a wide range of applications. However, a vulnerability has been discovered in TensorFlow that can lead to a denial of service (DoS) attack.
Vulnerability Detail
The vulnerability (CVE-2021-29547) in TensorFlow exists in the tf.raw_ops.QuantizedBatchNormWithGlobalNormalization function. An attacker can trigger a segmentation fault and cause a DoS by accessing data outside of the bounds. The implementation assumes that the inputs are not empty, but if any of the inputs is empty, accessing the element at index 0 will result in accessing data outside of the bounds. This vulnerability can be exploited by an attacker to crash the application or cause it to become unresponsive, leading to a DoS condition. The impact of this vulnerability can be severe, as it can disrupt critical machine learning processes and affect the availability of TensorFlow-based applications.
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.2.0rc02.2.0rc0pip install --upgrade "tensorflow==2.2.0rc0" -
>= 2.2.0, < 2.3.0rc02.3.0rc0pip install --upgrade "tensorflow==2.3.0rc0" -
>= 2.3.0, < 2.3.42.3.4pip install --upgrade "tensorflow==2.3.4" -
>= 2.4.0, < 2.4.32.4.3pip install --upgrade "tensorflow==2.4.3"
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 check if any of the inputs to tf.raw_ops.QuantizedBatchNormWithGlobalNormalization are empty before calling the function. If any input is found to be empty, the function should not be called to avoid triggering the vulnerability. Here is an example of how to check for empty inputs in Python:
if input_tensor.size == 0:
# Do not call QuantizedBatchNormWithGlobalNormalization
else:
# Call QuantizedBatchNormWithGlobalNormalization
This workaround ensures that the vulnerable function is not called with empty inputs, preventing the out-of-bounds access.
Conclusion
The vulnerability (CVE-2021-29547) in TensorFlow can be exploited by an attacker to cause a denial of service (DoS) by accessing data outside of the bounds. It is crucial for users to update their TensorFlow installations to the latest patched version as soon as it becomes available. In the meantime, a temporary workaround is available to check for empty inputs before calling the vulnerable function. For further support on 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 ecosystem of tools and resources.
This vulnerability can lead to a denial of service (DoS) attack by causing a segmentation fault and crashing the application.
The vulnerability will be fixed in TensorFlow 2.5.0. Users should update their installations to the latest patched version.
Yes, earlier versions including TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3, and TensorFlow 2.1.4 are also affected.
Yes, users can check for empty inputs before calling the vulnerable function to avoid triggering the vulnerability.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.