CVE-2021-37665: TensorFlow GPU - Incomplete Validation in MKL Implementation of Requantization
Summary
CVE-2021-37665: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow-gpu across 4 version ranges.
>= 2.3.0, < 2.3.4
>= 2.4.0, < 2.4.3
< 9e62869465573cb2d9b5053f1fa02a81fce21d69
< 203214568f5bc237603dbab6e1fd389f1572f5c9
Fixed in 2.3.4 or 2.4.3, depending on the release line you run. How to fix ↓
Also tracked for
- tensorflow · Bitnami
- tensorflow · PyPI
- tensorflow · PyPI
- tensorflow-cpu · PyPI
The same CVE-2021-37665 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 GPU is a variant of TensorFlow that leverages the power of GPUs for accelerated computation. It is widely used in various industries and research domains for training and inference of deep learning models.
Vulnerability Detail
In affected versions of TensorFlow GPU, there is an incomplete validation issue in the MKL (Math Kernel Library) implementation of requantization. This vulnerability allows an attacker to trigger undefined behavior by binding a reference to a null pointer or accessing data outside the bounds of heap allocated arrays. The issue arises due to the lack of dimension validation in the input tensor of the MKL implementation. A similar issue is also present in the MklRequantizePerChannelOp implementation. Exploiting this vulnerability can lead to crashes, memory corruption, or potentially allow an attacker to execute arbitrary code.
How To Fix
Latest published version: 2.12.0 as of 22 Oct 2026
pip install --upgrade "tensorflow-gpu==2.12.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.0, < 2.3.42.3.4pip install --upgrade "tensorflow-gpu==2.3.4" -
>= 2.4.0, < 2.4.32.4.3pip install --upgrade "tensorflow-gpu==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 consider implementing input validation checks in their own code to ensure the dimensions of the input tensor are valid before passing it to the vulnerable MKL operations. Here's an example of how to perform input validation in Python:
import tensorflow as tf
def validate_input(input_tensor):
if input_tensor.shape[0] <= 0:
raise ValueError('Invalid input tensor dimensions')
# Perform other necessary validation checks
# Usage
input_tensor = ...
validate_input(input_tensor)
# Call the vulnerable MKL operation
Conclusion
In conclusion, TensorFlow GPU versions prior to the patched releases are vulnerable to an incomplete validation issue in the MKL implementation of requantization. This vulnerability can have serious consequences, including crashes, memory corruption, and potential code execution. Users are strongly advised to update their TensorFlow GPU installations to the patched versions once they are available. If you need further assistance or support in addressing this vulnerability, please reach out to DevNack.com.
See every vulnerability recorded for tensorflow-gpu →
FAQ
TensorFlow GPU is a variant of TensorFlow that utilizes GPUs for accelerated computation. It is commonly used for training and inference of deep learning models.
MKL (Math Kernel Library) is a highly optimized library of mathematical functions for scientific and engineering applications. It provides accelerated implementations of various mathematical operations, including requantization in the context of TensorFlow.
Exploiting this vulnerability can lead to crashes, memory corruption, or potentially allow an attacker to execute arbitrary code. It is important to update to the patched versions of TensorFlow GPU to mitigate the risk.
You can use the Vulert Playground at Vulert Scanner to check if your application is affected by this vulnerability. Simply provide your Pipfile.lock and it will analyze the dependencies to identify any known vulnerabilities.
You can find more information about this vulnerability in the TensorFlow GitHub advisory database at https://github.com/pypa/advisory-database/blob/main/vulns/tensorflow-gpu/PYSEC-2021-776.yaml
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-gpu.