CVE-2021-41199: TensorFlow-CPU - Integer Overflow in tf.image.resize
Summary
CVE-2021-41199: TensorFlow is an open source platform for machine learning. Affects tensorflow-cpu across 5 version ranges.
< 2.4.4
>= 2.5.0, < 2.5.2
>= 2.6.0, < 2.6.1
>= 2.7.0rc0, < 2.7.0
< e5272d4204ff5b46136a1ef1204fc00597e21837
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-41199 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 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 within TensorFlow that focuses on CPU-based computations. It is widely used in various industries and research domains for training and inference tasks. However, a vulnerability has been identified in TensorFlow-CPU that can lead to a process crash when the tf.image.resize function is called with a large input argument.
Vulnerability Detail
The vulnerability arises due to an integer overflow in the tf.image.resize function of TensorFlow-CPU. When this function is invoked with a large input argument, the number of elements in the output tensor exceeds the capacity of the int64_t type, causing an overflow. This overflow is detected by a CHECK statement, resulting in a process crash. An attacker could potentially exploit this vulnerability to cause a denial-of-service (DoS) condition by triggering the crash of a TensorFlow process. The vulnerability affects versions of TensorFlow-CPU up to and including 2.7.0rc0.
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.4.42.4.4pip install --upgrade "tensorflow-cpu==2.4.4" -
>= 2.5.0, < 2.5.22.5.2pip install --upgrade "tensorflow-cpu==2.5.2" -
>= 2.6.0, < 2.6.12.6.1pip install --upgrade "tensorflow-cpu==2.6.1" -
>= 2.7.0rc0, < 2.7.02.7.0pip install --upgrade "tensorflow-cpu==2.7.0"
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 workaround, users can avoid triggering the vulnerability by ensuring that the input argument provided to the tf.image.resize function is within a reasonable range. It is recommended to validate and sanitize user inputs before passing them to this function. Here is an example of how to perform input validation in Python:
import tensorflow as tf
def safe_resize(image, size):
if size < 0 or size > 10000:
raise ValueError('Invalid size')
return tf.image.resize(image, size)
Conclusion
In conclusion, a vulnerability has been identified in TensorFlow-CPU that can result in a process crash when the tf.image.resize function is called with a large input argument. This vulnerability has been addressed in the latest versions of TensorFlow-CPU, and users are advised to update their installations to the fixed versions. For further assistance or support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow-cpu →
FAQ
TensorFlow is an open-source platform for machine learning that provides a comprehensive ecosystem of tools, libraries, and resources for developing and deploying machine learning models.
TensorFlow-CPU is a specific package within TensorFlow that focuses on CPU-based computations. It is widely used for training and inference tasks in various industries and research domains.
The vulnerability can lead to a process crash in TensorFlow-CPU when the tf.image.resize function is called with a large input argument. This can potentially be exploited by an attacker to cause a denial-of-service (DoS) condition.
The vulnerability affects TensorFlow-CPU versions up to and including 2.7.0rc0.
To fix this vulnerability, it is recommended to update the TensorFlow-CPU package to one of the fixed versions: TensorFlow 2.7.0, TensorFlow 2.6.1, TensorFlow 2.5.2, or TensorFlow 2.4.4.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-cpu.