CVE-2021-41199: TensorFlow - Integer Overflow in tf.image.resize
Summary
CVE-2021-41199: TensorFlow is an open source platform for machine learning. Affects tensorflow 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-cpu · 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 building and deploying 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 and specifically impacts the tf.image.resize function.
Vulnerability Detail
The vulnerability (CVE-2021-41199) arises when the tf.image.resize function is called with a large input argument. In affected versions of TensorFlow, this can lead to a CHECK-failure caused by an integer overflow. The number of elements in the output tensor exceeds the capacity of the int64_t type, triggering the overflow and resulting in a process crash. The issue has been identified and fixed in TensorFlow 2.7.0. However, earlier versions, including TensorFlow 2.6.1, 2.5.2, and 2.4.4, are also affected. The overflow detection is performed through a CHECK statement, which aborts the process upon detection.
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.4.42.4.4pip install --upgrade "tensorflow==2.4.4" -
>= 2.5.0, < 2.5.22.5.2pip install --upgrade "tensorflow==2.5.2" -
>= 2.6.0, < 2.6.12.6.1pip install --upgrade "tensorflow==2.6.1" -
>= 2.7.0rc0, < 2.7.02.7.0pip install --upgrade "tensorflow==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
There is no specific workaround mentioned for this vulnerability. The recommended approach is to update TensorFlow to the fixed versions mentioned above.
Conclusion
In conclusion, the vulnerability (CVE-2021-41199) in TensorFlow's tf.image.resize function can lead to a process crash due to an integer overflow when called with a large input argument. It is crucial to update TensorFlow to the fixed versions (2.7.0, 2.6.1, 2.5.2, or 2.4.4) to mitigate this issue. For further support and assistance in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open-source platform for machine learning that provides a comprehensive set of tools and libraries for building and deploying ML models.
The vulnerability can cause a process crash in TensorFlow when the tf.image.resize function is called with a large input argument.
The vulnerability affects TensorFlow versions 2.4.4, 2.5.2, 2.6.1, and earlier. The issue has been fixed in TensorFlow 2.7.0.
To fix this vulnerability, update TensorFlow to version 2.7.0 or upgrade to one of the patched versions: 2.6.1, 2.5.2, or 2.4.4.
No specific workaround has been provided. Updating to the fixed versions is the recommended solution.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.