CVE-2022-23562: Integer Overflow in TensorFlow Range Function
Summary
CVE-2022-23562: Tensorflow is an Open Source Machine Learning Framework. Affects tensorflow-gpu across 3 version ranges.
< 2.5.3
>= 2.6.0, < 2.6.3
< f0147751fd5d2ff23251149ebad9af9f03010732
Fixed in 2.5.3 or 2.6.3, depending on the release line you run. How to fix ↓
Also tracked for
- tensorflow · PyPI
- tensorflow · Bitnami
- tensorflow · PyPI
- tensorflow-cpu · PyPI
The same CVE-2022-23562 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 widely used for developing and deploying machine learning models. It provides a comprehensive set of tools and libraries for building and training neural networks. The TensorFlow package includes a function called Range that generates a sequence of numbers within a specified range. This function is susceptible to integer overflows, which can lead to undefined behavior or large memory allocations.
Vulnerability Detail
The vulnerability in the Range function arises from integer overflows. When certain inputs are provided, the function fails to handle large numbers correctly, resulting in undefined behavior or excessive memory allocation. This vulnerability can be exploited by an attacker to cause a denial-of-service (DoS) condition or potentially execute arbitrary code. The impact of this vulnerability depends on how the affected function is used within TensorFlow applications.
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.5.32.5.3pip install --upgrade "tensorflow-gpu==2.5.3" -
>= 2.6.0, < 2.6.32.6.3pip install --upgrade "tensorflow-gpu==2.6.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 workaround, users can avoid using the Range function with inputs that may trigger the vulnerability. If possible, alternative methods or custom implementations can be used to achieve the desired functionality without relying on the vulnerable function. Here is an example of a workaround that replaces the usage of Range with a custom implementation:
# Custom range function
def custom_range(start, stop, step=1):
result = []
current = start
while current < stop:
result.append(current)
current += step
return result
# Usage example
numbers = custom_range(0, 10, 2)
print(numbers)
By using the custom_range function instead of the vulnerable Range function, users can avoid the potential risks associated with the vulnerability.
Conclusion
The vulnerability in the Range function of TensorFlow can lead to undefined behavior or excessive memory allocation due to integer overflows. It is crucial for users of TensorFlow to update their installations to the fixed versions (2.8.0, 2.7.1, 2.6.3, or 2.5.3) to mitigate the risk. By following the recommended steps, users can ensure the security and stability of their TensorFlow applications. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow-gpu →
FAQ
TensorFlow is an open-source machine learning framework used for developing and deploying machine learning models. It provides a comprehensive set of tools and libraries for building and training neural networks.
The Range function in TensorFlow generates a sequence of numbers within a specified range. It is commonly used for creating input data or iterating over a range of values in machine learning applications.
An integer overflow occurs when the result of an arithmetic operation exceeds the maximum value that can be represented by the data type. In the case of the Range function vulnerability, certain inputs can trigger integer overflows, leading to undefined behavior or excessive memory allocation.
The consequences of this vulnerability depend on how the affected function is used within TensorFlow applications. In some scenarios, it can result in a denial-of-service (DoS) condition, where the application becomes unresponsive or crashes. In more severe cases, it may be possible for an attacker to exploit the vulnerability to execute arbitrary code.
To protect your TensorFlow application from this vulnerability, it is recommended to update your TensorFlow installation to one of the fixed versions (2.8.0, 2.7.1, 2.6.3, or 2.5.3). This can be done by upgrading the package using the package manager or by manually installing the fixed version from the official TensorFlow repository.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-gpu.