CVE-2021-29605: TensorFlow GPU - Integer Overflow in TFLite Code
Summary
CVE-2021-29605: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow-gpu 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
< 7c8cc4ec69cd348e44ad6a2699057ca88faad3e5
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-cpu · PyPI
The same CVE-2021-29605 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 lets researchers and developers easily build and deploy machine learning models. TensorFlow GPU is a variant of TensorFlow that leverages GPU acceleration for faster computation. It is widely used in various industries and research domains.
Vulnerability Detail
The TFLite code in TensorFlow GPU is vulnerable to an integer overflow issue. Specifically, the code for allocating TFLiteIntArrays is susceptible to an integer overflow when the size multiplier is too large, causing the return value to overflow the int datatype and become negative. This leads to an invalid value being passed to the malloc function, resulting in the dereferencing of an invalid pointer (ret->size). An attacker can exploit this vulnerability by crafting a malicious model that triggers the integer overflow, potentially leading to memory corruption or crashes. The vulnerability has been assigned the identifier CVE-2021-29605.
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.1.42.1.4pip install --upgrade "tensorflow-gpu==2.1.4" -
>= 2.2.0, < 2.2.32.2.3pip install --upgrade "tensorflow-gpu==2.2.3" -
>= 2.3.0, < 2.3.32.3.3pip install --upgrade "tensorflow-gpu==2.3.3" -
>= 2.4.0, < 2.4.22.4.2pip install --upgrade "tensorflow-gpu==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
As a temporary workaround, if upgrading to a fixed version is not immediately feasible, you can consider avoiding the usage of TFLite code that involves the allocation of TFLiteIntArrays. By minimizing or eliminating the usage of this specific functionality, you can reduce the likelihood of triggering the integer overflow vulnerability.
Conclusion
The integer overflow vulnerability in the TFLite code of TensorFlow GPU can be mitigated by upgrading to the fixed versions or applying the backported fixes. It is crucial to keep your TensorFlow GPU installation up to date to ensure the security and stability of your machine learning workflows. For further support and assistance in vulnerability remediation, you can reach out to DevNack.com.
See every vulnerability recorded for tensorflow-gpu →
FAQ
TensorFlow GPU is a variant of TensorFlow that utilizes GPU acceleration for faster machine learning computations. It is commonly used in scenarios where high-performance computing is required.
TFLite is a TensorFlow library for deploying machine learning models on mobile and embedded devices. It provides a lightweight runtime that enables efficient execution of TensorFlow models on resource-constrained platforms.
An attacker can exploit this vulnerability by crafting a malicious model that triggers the integer overflow in the TFLite code. By providing a large size multiplier, the attacker can cause the return value to overflow the int datatype and become negative, leading to memory corruption or crashes.
The integer overflow vulnerability in the TFLite code can potentially result in memory corruption or crashes. This can impact the stability and reliability of TensorFlow GPU, potentially leading to denial-of-service (DoS) scenarios or the execution of arbitrary code.
Yes, the vulnerability has been fixed in TensorFlow 2.5.0. It is recommended to upgrade to the latest fixed version. Backported fixes are also available for earlier versions, including TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3, and TensorFlow 2.1.4.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-gpu.