CVE-2021-37674: Incomplete validation in MaxPoolGrad of TensorFlow
Summary
CVE-2021-37674: Incomplete validation in MaxPoolGrad. Affects tensorflow across 3 version ranges.
< 2.3.4
>= 2.4.0, < 2.4.3
>= 2.5.0, < 2.5.1
Fixed in 2.3.4, 2.4.3 or 2.5.1, depending on the release line you run. How to fix ↓
Also tracked for
- tensorflow · Bitnami
- tensorflow-cpu · PyPI
- tensorflow-gpu · PyPI
The same CVE-2021-37674 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 open-source machine learning framework developed by Google. It provides a comprehensive ecosystem of tools, libraries, and community resources for building and deploying machine learning models. TensorFlow includes various operations and functions for performing mathematical computations and building neural networks. One of these operations is MaxPoolGrad, which is used for computing the gradients of the max pooling operation. However, a vulnerability has been discovered in the implementation of MaxPoolGrad that can lead to a denial of service (DoS) attack.
Vulnerability Detail
The vulnerability (CVE-2021-37674) in MaxPoolGrad arises from incomplete validation of the orig_input and orig_output tensors. An attacker can exploit this vulnerability by providing malicious input to the MaxPoolGrad operation, triggering a segmentation fault and causing a DoS condition. The issue was initially addressed in a previous fix (CVE-2021-29579), but the fix was incomplete. The impact of this vulnerability is considered moderate, with a CVSS score of 5.5. It is important to note that this vulnerability affects multiple versions of TensorFlow.
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.3.42.3.4pip install --upgrade "tensorflow==2.3.4" -
>= 2.4.0, < 2.4.32.4.3pip install --upgrade "tensorflow==2.4.3" -
>= 2.5.0, < 2.5.12.5.1pip install --upgrade "tensorflow==2.5.1"
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 avoid using the MaxPoolGrad operation with untrusted or malicious input. By carefully validating and sanitizing the input tensors before passing them to MaxPoolGrad, the risk of triggering the vulnerability can be mitigated. Here is an example of how to validate the input tensors:
import tensorflow as tf
orig_input = tf.constant([], shape=[3, 0, 0, 2], dtype=tf.float32)
orig_output = tf.constant([], shape=[3, 0, 0, 2], dtype=tf.float32)
grad = tf.constant([], shape=[3, 0, 0, 2], dtype=tf.float32)
if orig_input.shape[1] > 0 and orig_output.shape[1] > 0:
tf.raw_ops.MaxPoolGrad(
orig_input=orig_input,
orig_output=orig_output,
grad=grad,
ksize=[1, 16, 16, 1],
strides=[1, 16, 18, 1],
padding="EXPLICIT",
explicit_paddings=[0, 0, 14, 3, 15, 5, 0, 0]
)
Conclusion
The vulnerability in MaxPoolGrad of TensorFlow (CVE-2021-37674) can lead to a denial of service (DoS) condition. It is important for users to update their TensorFlow installations to the patched versions and follow the recommended security practices. For further assistance or support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open-source machine learning framework developed by Google. It provides a comprehensive ecosystem of tools, libraries, and community resources for building and deploying machine learning models.
MaxPoolGrad is an operation in TensorFlow used for computing the gradients of the max pooling operation. It is commonly used in neural network architectures for backpropagation and gradient-based optimization.
The vulnerability in MaxPoolGrad can be exploited by an attacker to trigger a denial of service (DoS) condition. By providing malicious input, the attacker can cause a segmentation fault and crash the TensorFlow application.
Yes, the TensorFlow team has released patches to address this vulnerability. Users are advised to update their TensorFlow installations to the patched versions: TensorFlow 2.6.0, TensorFlow 2.5.1, TensorFlow 2.4.3, or TensorFlow 2.3.4.
As a temporary workaround, users can validate and sanitize the input tensors before using the MaxPoolGrad operation. By carefully checking the shape and content of the tensors, the risk of triggering the vulnerability can be mitigated.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.