CVE-2022-23561: Out-of-Bounds Write Vulnerability in TensorFlow
Summary
CVE-2022-23561: Tensorflow is an Open Source Machine Learning Framework. Affects tensorflow-cpu across 3 version ranges.
< 2.5.3
>= 2.6.0, < 2.6.3
< 6c0b2b70eeee588591680f5b7d5d38175fd7cdf6
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-23561 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 ecosystem for building and training various types of neural networks. TensorFlow is available in different versions, including TensorFlow CPU, which is a Python package for running TensorFlow on CPUs. This vulnerability affects TensorFlow CPU versions 0.0.0 to 2.5.2, 2.6.0 to 2.6.2, and 2.7.0 to 2.7.0. The vulnerability allows an attacker to craft a TFLite model that triggers a write outside the bounds of an array in TFLite, potentially leading to arbitrary write operations and memory corruption.
Vulnerability Detail
The vulnerability arises from a flaw in the memory allocator used by TFLite. By manipulating the TFLite model, an attacker can overwrite the linked list used by the memory allocator, enabling arbitrary write operations. This can have severe consequences, including remote code execution or denial of service attacks. The impact of the vulnerability depends on the context in which TensorFlow is used and the privileges of the user running the affected application. The vulnerability has been assigned CVE-2022-23561.
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 →
Workaround
As a workaround, users can consider implementing input validation and sanitization mechanisms to ensure that only trusted TFLite models are processed. Additionally, restricting access to TensorFlow CPU in production environments can help mitigate the risk of exploitation. However, applying the official fix by updating to a patched version is the most effective way to address the vulnerability.
Conclusion
The out-of-bounds write vulnerability in TensorFlow CPU can have serious security implications, allowing attackers to perform arbitrary write operations. It is crucial to update to the latest patched version of TensorFlow CPU (2.8.0) or apply the backported fixes for older versions (2.7.1, 2.6.3, and 2.5.3) to mitigate the vulnerability. Regularly monitoring for security updates and following best practices for secure software development are essential to protect against such vulnerabilities. For further assistance or support 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 building and training neural networks.
TFLite is a lightweight version of TensorFlow designed for mobile and embedded devices.
The vulnerability allows an attacker to perform arbitrary write operations, potentially leading to remote code execution or denial of service attacks.
The vulnerability affects TensorFlow CPU versions 0.0.0 to 2.5.2, 2.6.0 to 2.6.2, and 2.7.0 to 2.7.0.
Updating to the latest available version of TensorFlow CPU (2.8.0 or patched versions for older versions) is recommended. Implementing input validation and sanitization mechanisms can also help reduce the risk of exploitation.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-cpu.