CVE-2022-23576: Integer Overflow in TensorFlow
Summary
CVE-2022-23576: Integer overflow in Tensorflow. Affects tensorflow across 3 version ranges.
< 2.5.3
>= 2.6.0, < 2.6.3
>= 2.7.0, < 2.7.1
Fixed in 2.5.3, 2.6.3 or 2.7.1, depending on the release line you run. How to fix ↓
Also tracked for
- tensorflow · Bitnami
- tensorflow-gpu · PyPI
- tensorflow-cpu · PyPI
The same CVE-2022-23576 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 training various deep learning models. It provides a comprehensive ecosystem of tools, libraries, and resources for building and deploying machine learning applications. TensorFlow is vulnerable to an integer overflow issue that can be exploited if an attacker can create an operation involving tensors with a large number of elements.
Vulnerability Detail
The vulnerability lies in the implementation of the OpLevelCostEstimator::CalculateOutputSize function in TensorFlow. Specifically, the code multiplies the sizes of the dimensions in the output_shape tensor to calculate the output size. However, if the number of dimensions or the size of a few dimensions is large enough, an integer overflow can occur during the multiplication. This can lead to unexpected behavior, memory corruption, or even remote code execution.
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.5.32.5.3pip install --upgrade "tensorflow==2.5.3" -
>= 2.6.0, < 2.6.32.6.3pip install --upgrade "tensorflow==2.6.3" -
>= 2.7.0, < 2.7.12.7.1pip install --upgrade "tensorflow==2.7.1"
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 the vulnerability by ensuring that the input tensors and operations do not involve a large number of elements. This can be achieved by carefully designing the models and operations to limit the size of the tensors used. Additionally, input validation and sanitization can help prevent potential attacks exploiting the vulnerability.
Conclusion
The integer overflow vulnerability in TensorFlow can have serious consequences, including unexpected behavior, memory corruption, or remote code execution. It is crucial for users to update their TensorFlow installations to the patched versions (2.5.3, 2.6.3, 2.7.1, or 2.8.0) to mitigate the risk. Additionally, careful design of models and operations, along with input validation and sanitization, can help prevent potential attacks. For further support and assistance in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
The vulnerability can lead to an integer overflow, which can result in unexpected behavior, memory corruption, or even remote code execution. Exploiting this vulnerability requires an attacker to create an operation involving tensors with a large number of elements.
The vulnerability affects TensorFlow versions 2.5.3, 2.6.0 to 2.6.2, 2.6.3, 2.7.0 to 2.7.1, and 2.8.0 (prior to the patched versions).
There are no known public exploits for this vulnerability at the time of this advisory. However, it is important to apply the patches promptly to mitigate any potential risks.
Yes, this vulnerability can be exploited remotely if an attacker can create an operation involving tensors with a large number of elements. The impact of the exploitation depends on the specific context and usage of TensorFlow in the affected application.
For more information about this vulnerability, including the technical details and the patch implementation, please refer to the TensorFlow security guide and the GitHub commit mentioned in the vulnerability details section.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.