CVE-2023-25662: TensorFlow Integer Overflow in EditDistance
Summary
CVE-2023-25662: TensorFlow vulnerable to integer overflow in EditDistance. Affects tensorflow versions < 2.11.1. Fixed in 2.11.1. How to fix ↓
Also tracked for
- tensorflow-cpu · PyPI
- tensorflow-gpu · PyPI
- tensorflow · Bitnami
The same CVE-2023-25662 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 developed by Google. 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. However, a vulnerability has been discovered in TensorFlow version 2.11.0, specifically in the EditDistance function. This vulnerability can lead to an integer overflow, resulting in a deadlock and potential denial of service.
Vulnerability Detail
The vulnerability in TensorFlow's EditDistance function arises from a flaw in the handling of empty hypothesis_shape_t. When hypothesis_shape_t is empty, the calculation of hypothesis_shape_t->NumElements() - 1 causes an integer overflow. This integer overflow can lead to a deadlock, impacting the availability of the TensorFlow application. An attacker could potentially exploit this vulnerability to disrupt the functioning of TensorFlow-based systems.
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 version below is the minimum fixed release for this vulnerability.
If you need the minimum change
2.11.1
This is the first release that contains the fix.
pip install --upgrade "tensorflow==2.11.1"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, users can modify the code to ensure that hypothesis_shape_t is not empty before invoking the EditDistance function. For example, the following code snippet demonstrates a workaround:
import tensorflow as tf
para = {
'hypothesis_indices': [[]],
'hypothesis_values': ['tmp/'],
'hypothesis_shape': [1],
'truth_indices': [[]],
'truth_values': [''],
'truth_shape': [],
'normalize': False
}
tf.raw_ops.EditDistance(**para)
By providing a non-empty hypothesis_shape, the integer overflow can be avoided.
Conclusion
In conclusion, TensorFlow version 2.11.0 is vulnerable to an integer overflow in the EditDistance function. This vulnerability can lead to a deadlock and potential denial of service. Users are strongly advised to update their TensorFlow installations to versions 2.11.1 or 2.12.0 once they become available. Additionally, a temporary workaround is available by modifying the code to provide a non-empty hypothesis_shape. For further support and assistance in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open-source machine learning framework developed by Google. It provides a comprehensive ecosystem of tools, libraries, and resources for building and deploying machine learning models.
The vulnerability can lead to an integer overflow and subsequent deadlock, potentially resulting in a denial of service. Attackers could exploit this vulnerability to disrupt TensorFlow-based systems.
The vulnerability affects TensorFlow version 2.11.0. Users of this version should update to either 2.11.1 or 2.12.0 once available.
Yes, the vulnerability has been patched in TensorFlow 2.11.1 and will also be fixed in TensorFlow 2.12.0. Users are advised to update their installations to these versions.
Yes, a temporary workaround involves ensuring that hypothesis_shape_t is not empty before invoking the EditDistance function. This can be achieved by providing a non-empty hypothesis_shape.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.