CVE-2023-25659: TensorFlow Out-of-Bounds Read in DynamicStitch
Summary
CVE-2023-25659: TensorFlow vulnerable to Out-of-Bounds Read in DynamicStitch. 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-25659 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 deep learning models. It provides a comprehensive ecosystem for building and deploying machine learning applications. TensorFlow is vulnerable to an Out-of-Bounds Read in the DynamicStitch function. This function can trigger a stack-based out-of-bounds read if the indices parameter does not match the shape of the data parameter. This vulnerability can potentially lead to information disclosure or denial of service.
Vulnerability Detail
The vulnerability arises when the indices parameter for the DynamicStitch function does not match the shape of the data parameter. This mismatch can cause a stack-based out-of-bounds read, potentially leading to information disclosure or denial of service. An attacker could exploit this vulnerability by providing malicious input to the affected function. The vulnerability has been assigned a CVSS score of 7.5, indicating a high severity level.
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
If updating TensorFlow is not immediately feasible, a temporary workaround can be implemented by validating the indices and data parameters before passing them to the DynamicStitch function. Ensure that the shapes of both parameters match to avoid triggering the vulnerability. Here is an example of how to perform the validation:
import tensorflow as tf
def safe_dynamic_stitch(indices, data):
if len(indices) == len(data):
return tf.raw_ops.DynamicStitch(indices=indices, data=data)
else:
raise ValueError('Indices and data must have the same shape.')
# Usage
indices = [[0xdeadbeef], [405], [519], [758], [1015]]
data = [[110.27793884277344], [120.29475402832031], [157.2418212890625], [157.2626953125], [188.45382690429688]]
y = safe_dynamic_stitch(indices, data)
By implementing this workaround, the vulnerability can be mitigated until the TensorFlow library is updated.
Conclusion
The vulnerability in TensorFlow's DynamicStitch function can lead to an out-of-bounds read, potentially resulting in information disclosure or denial of service. To mitigate this vulnerability, it is recommended to update TensorFlow to version 2.11.1 or later. A temporary workaround is available by validating the parameters before using the affected function. For further assistance and support 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 for building and deploying machine learning models.
The vulnerability in TensorFlow can lead to an out-of-bounds read, potentially resulting in information disclosure or denial of service.
To fix this vulnerability, update TensorFlow to version 2.11.1 or later. The issue has been patched in the latest versions.
Yes, a temporary workaround is to validate the indices and data parameters before using the DynamicStitch function. Ensure that their shapes match.
The CVSS score of this vulnerability is 7.5, indicating a high severity level.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.