CVE-2022-23567: TensorFlow Integer Overflow Vulnerability
Summary
CVE-2022-23567: Integer overflows 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-23567 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 library widely used for machine learning and deep learning applications. It provides a flexible ecosystem for building and deploying machine learning models. However, certain operations within TensorFlow, specifically the SparseCwise operations, have been found to be vulnerable to integer overflow issues, which can lead to significant security risks.
Vulnerability Detail
The vulnerability arises from the implementations of SparseCwise operations in TensorFlow, which lack proper validation on the shapes of input tensors. This oversight can lead to integer overflows, allowing attackers to trigger large memory allocations, resulting in out-of-memory (OOM) conditions or assertion failures during the construction of TensorShape objects. Such conditions can be exploited to cause denial of service attacks, impacting the availability of applications relying on TensorFlow.
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, ensure that the input shapes for SparseCwise operations are validated before passing them to the function. For example, you can check the dimensions of the input tensors to prevent large allocations. Here is a sample code snippet to validate input shapes:
import tensorflow as tf import numpy as np
sp_indices = np.array([[9]]) sp_values = np.array([5]) sp_shape = np.array([92233720368., 92233720368]) dense = np.array([4])
if sp_shape[0] < 92233720368 and sp_shape[1] < 92233720368: result = tf.raw_ops.SparseDenseCwiseDiv(sp_indices=sp_indices, sp_values=sp_values, sp_shape=sp_shape, dense=dense) else: print('Input shape is too large, operation aborted.')
Conclusion
The integer overflow vulnerability in TensorFlow, identified as CVE-2022-23567, poses significant risks to applications using the library. Users are encouraged to update to the latest patched versions to ensure their systems remain secure. Implementing input validation can also help mitigate potential risks until an upgrade is feasible.
See every vulnerability recorded for tensorflow →
FAQ
CVE-2022-23567 is a vulnerability in TensorFlow that allows for integer overflows in SparseCwise operations, potentially leading to denial of service.
You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.
The vulnerability affects TensorFlow versions prior to 2.5.3, 2.6.3, and 2.7.1.
If you cannot upgrade immediately, implement input shape validation as a temporary workaround to mitigate the risk of exploitation.
The CVSS score of this vulnerability is 6.5, indicating a moderate severity level.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.