CVE-2021-29520: TensorFlow - Missing Validation in Conv3DBackprop Operations
Summary
CVE-2021-29520: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow 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
< 8f37b52e1320d8d72a9529b2468277791a261197
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-29520 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 community resources that enable researchers and developers to build and deploy machine learning models. TensorFlow is widely used in various domains, including computer vision, natural language processing, and deep learning. This vulnerability affects the TensorFlow package, specifically the tf.raw_ops.Conv3DBackprop* operations.
Vulnerability Detail
The vulnerability arises from missing validation between arguments to tf.raw_ops.Conv3DBackprop* operations in TensorFlow. The implementation assumes that the input, filter_sizes, and out_backprop tensors have the same shape, as they are accessed in parallel. However, if these tensors have different shapes, it can lead to heap buffer overflows. An attacker could exploit this vulnerability to execute arbitrary code or cause a denial of service. The issue has been identified and fixed in TensorFlow 2.5.0, and the fix has also been backported to earlier versions within the supported range (2.4.2, 2.3.3, 2.2.3, and 2.1.4).
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.1.42.1.4pip install --upgrade "tensorflow==2.1.4" -
>= 2.2.0, < 2.2.32.2.3pip install --upgrade "tensorflow==2.2.3" -
>= 2.3.0, < 2.3.32.3.3pip install --upgrade "tensorflow==2.3.3" -
>= 2.4.0, < 2.4.22.4.2pip install --upgrade "tensorflow==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
If upgrading to a fixed version is not immediately feasible, a workaround can be implemented by manually validating the shapes of the input, filter_sizes, and out_backprop tensors before invoking the tf.raw_ops.Conv3DBackprop* operations. Here's an example of how the validation can be performed:
import tensorflow as tf
def conv3d_backprop_workaround(input, filter_sizes, out_backprop):
if input.shape != filter_sizes.shape or input.shape != out_backprop.shape:
raise ValueError('Input shapes do not match')
# Perform the Conv3DBackprop operation
result = tf.raw_ops.Conv3DBackprop(...)
return result
Conclusion
The vulnerability in TensorFlow, identified as CVE-2021-29520, can lead to heap buffer overflows if the input, filter_sizes, and out_backprop tensors have different shapes. This can be exploited by an attacker to execute arbitrary code or cause a denial of service. It is crucial to upgrade to TensorFlow 2.5.0 or apply the provided patches to mitigate the vulnerability. For further support on vulnerability remediation, you can contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open source platform for machine learning that provides tools and libraries for building and deploying machine learning models.
The vulnerability can result in heap buffer overflows, which may allow an attacker to execute arbitrary code or cause a denial of service.
The vulnerability affects TensorFlow versions 2.1.4 and above, including versions 2.4.2, 2.3.3, 2.2.3, and 2.1.4.
Yes, the vulnerability has been fixed in TensorFlow 2.5.0. The fix has also been backported to earlier versions within the supported range (2.4.2, 2.3.3, 2.2.3, and 2.1.4).
To fix this vulnerability, it is recommended to upgrade to TensorFlow version 2.5.0 or apply the respective patches for the affected versions (2.4.2, 2.3.3, 2.2.3, and 2.1.4).
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.