CVE-2021-29517: TensorFlow Division by Zero in Conv3D Implementation
Summary
CVE-2021-29517: 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
< 799f835a3dfa00a4d852defa29b15841eea9d64f
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-29517 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 includes various operations and functions for performing convolutional operations, such as the Conv3D implementation. This implementation is used for 3D convolutional operations in deep learning models. However, a vulnerability exists in the Conv3D implementation that can be exploited by a malicious user.
Vulnerability Detail
The vulnerability in the Conv3D implementation arises from a division by zero error. The implementation performs a modulo operation based on user-controlled input. If the fifth element of the filter tensor is set to 0, it results in a division by zero. This can lead to unexpected behavior or crashes in the program. Additionally, if the shape of the two tensors involved in the convolution operation is not valid, it can trigger an Eigen assertion and cause a program crash. The vulnerability can be exploited by an attacker to disrupt the execution of TensorFlow models or potentially execute arbitrary code.
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
There is no specific workaround provided for this vulnerability. The recommended approach is to upgrade to the patched versions of TensorFlow.
Conclusion
The division by zero vulnerability in the Conv3D implementation of TensorFlow can be exploited by a malicious user to disrupt the execution of TensorFlow models or potentially execute arbitrary code. It is recommended to upgrade to the patched versions of TensorFlow to mitigate this vulnerability. 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 tools and resources for building and deploying machine learning models.
Conv3D is an operation in TensorFlow that performs 3D convolutional operations, commonly used in deep learning models for processing volumetric data.
A malicious user can provide a filter tensor with a 0 as the fifth element, triggering a division by zero in the Conv3D implementation. This can lead to unexpected behavior or crashes in the program.
Eigen is a C++ template library for linear algebra. An Eigen assertion is a mechanism used in Eigen to check for conditions that should always hold true. In this vulnerability, an invalid shape of the tensors can trigger an Eigen assertion and cause a program crash.
The vulnerability affects TensorFlow versions 2.1.4 and above, including versions 2.2.3, 2.3.3, 2.4.2, and any versions in the 2.5.0 release candidate range.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-cpu.