CVE-2021-29583: TensorFlow-CPU FusedBatchNorm Heap Buffer Overflow
Summary
CVE-2021-29583: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow-cpu 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
< 6972f9dfe325636b3db4e0bc517ee22a159365c0
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-29583 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-CPU is a specific package that focuses on running TensorFlow on CPUs. It is widely used in various industries and research fields for machine learning tasks.
Vulnerability Detail
The vulnerability (CVE-2021-29583) exists in the implementation of tf.raw_ops.FusedBatchNorm in TensorFlow-CPU. This function is responsible for performing batch normalization, a common technique in machine learning. The vulnerability arises from a lack of validation in the function's implementation. Specifically, when the tensors scale, offset, mean, and variance (the last two only when required) have a different number of elements than the number of channels of the input tensor x, a heap buffer overflow can occur. This can lead to out-of-bounds reads, potentially resulting in memory corruption and arbitrary code execution. Additionally, if the tensors are empty, the lack of validation can trigger undefined behavior by dereferencing null pointers.
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.2.0rc02.2.0rc0pip install --upgrade "tensorflow-cpu==2.2.0rc0" -
>= 2.2.0, < 2.3.0rc02.3.0rc0pip install --upgrade "tensorflow-cpu==2.3.0rc0" -
>= 2.3.0, < 2.3.42.3.4pip install --upgrade "tensorflow-cpu==2.3.4" -
>= 2.4.0, < 2.4.32.4.3pip install --upgrade "tensorflow-cpu==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
There is no known workaround for this vulnerability. It is strongly recommended to apply the fix by upgrading to TensorFlow-CPU 2.5.0 or later.
Conclusion
The vulnerability (CVE-2021-29583) in TensorFlow-CPU's tf.raw_ops.FusedBatchNorm function can lead to a heap buffer overflow and undefined behavior. It is crucial to upgrade to TensorFlow-CPU 2.5.0 or later to mitigate this vulnerability. Upgrading to the latest version ensures that you have the necessary security patches and bug fixes. For further support on vulnerability remediation, you can reach out to 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, libraries, and resources for developing and deploying machine learning models.
TensorFlow-CPU is a specific package that focuses on running TensorFlow on CPUs. It is widely used for machine learning tasks in various industries and research fields.
Batch normalization is a technique commonly used in machine learning to normalize the inputs of a neural network layer. It helps improve the training stability and performance of the model.
A heap buffer overflow occurs when a program writes data beyond the allocated memory buffer in the heap. This can lead to memory corruption and potentially allow an attacker to execute arbitrary code.
To fix the vulnerability, you should upgrade your TensorFlow-CPU package to version 2.5.0 or later. Run the command pip install --upgrade tensorflow-cpu to update the package.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-cpu.