CVE-2022-21738: TensorFlow Integer Overflow in SparseCountSparseOutput
Summary
CVE-2022-21738: Tensorflow is an Open Source Machine Learning Framework. Affects tensorflow-cpu across 3 version ranges.
< 2.5.3
>= 2.6.0, < 2.6.3
< 6f4d3e8139ec724dbbcb40505891c81dd1052c4a
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-gpu · PyPI
The same CVE-2022-21738 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. TensorFlow is available on PyPI as the package 'tensorflow-cpu'.
Vulnerability Detail
The vulnerability identified as CVE-2022-21738 affects the TensorFlow framework. Specifically, the implementation of the 'SparseCountSparseOutput' function can trigger an integer overflow, leading to a crash of the TensorFlow process. This integer overflow occurs during a memory allocation, where the result of the overflow is mistakenly used. The impact of this vulnerability can result in denial of service (DoS) attacks or unexpected termination of TensorFlow processes.
How To Fix
Latest published version: 2.21.0 as of 22 Oct 2026
pip install --upgrade "tensorflow-cpu==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-cpu==2.5.3" -
>= 2.6.0, < 2.6.32.6.3pip install --upgrade "tensorflow-cpu==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 →
Conclusion
The identified vulnerability in TensorFlow's 'SparseCountSparseOutput' function can result in a crash of TensorFlow processes, potentially leading to denial of service (DoS) attacks or unexpected termination. It is crucial to update TensorFlow installations to the patched versions (2.7.1, 2.6.3, or 2.5.3) to mitigate this vulnerability. For further support and assistance in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow-cpu →
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 vulnerability can lead to a crash of TensorFlow processes, resulting in denial of service (DoS) attacks or unexpected termination of the affected processes.
To fix this vulnerability, update your TensorFlow installation to one of the following versions: TensorFlow 2.7.1, TensorFlow 2.6.3, or TensorFlow 2.5.3. These versions include the necessary patches to mitigate the issue.
No specific workaround has been provided for this vulnerability. It is recommended to update to the patched versions of TensorFlow.
You can find more information about this vulnerability in the TensorFlow advisory database. The source for this vulnerability report can be accessed at: https://github.com/pypa/advisory-database/blob/main/vulns/tensorflow-cpu/PYSEC-2022-62.yaml
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-cpu.