CVE-2022-29207: TensorFlow CPU - Undefined Behavior with Invalid Resource Handles
Summary
CVE-2022-29207: Undefined behavior when users supply invalid resource handles. Affects tensorflow-cpu across 3 version ranges.
< 2.6.4
>= 2.7.0, < 2.7.2
>= 2.8.0, < 2.8.1
Fixed in 2.6.4, 2.7.2 or 2.8.1, depending on the release line you run. How to fix ↓
Also tracked for
- tensorflow · PyPI
- tensorflow-gpu · PyPI
- tensorflow · Bitnami
- tensorflow · PyPI
The same CVE-2022-29207 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 that provides a comprehensive ecosystem for building and deploying machine learning models. It supports various operations and is widely used in both research and production environments. The framework allows users to perform computations using a graph-based approach or in eager execution mode. This vulnerability arises from improper handling of resource handles in eager mode, which can lead to undefined behavior when invalid handles are supplied.
Vulnerability Detail
The vulnerability occurs when users supply invalid resource handles to certain TensorFlow operations in eager mode. For instance, calling tf.raw_ops.QueueIsClosedV2 with an empty handle or tf.summary.flush with an empty writer can lead to a null pointer reference within the TensorFlow codebase. This undefined behavior can result in application crashes or unpredictable behavior, posing a significant risk to applications relying on TensorFlow for machine learning tasks.
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.6.42.6.4pip install --upgrade "tensorflow-cpu==2.6.4" -
>= 2.7.0, < 2.7.22.7.2pip install --upgrade "tensorflow-cpu==2.7.2" -
>= 2.8.0, < 2.8.12.8.1pip install --upgrade "tensorflow-cpu==2.8.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 temporary workaround, avoid passing empty resource handles to TensorFlow operations. For example, ensure that the handle parameter is valid and not an empty list or tuple before making the call. Here is an example of how to check the handle before calling the operation:
if handle: tf.raw_ops.QueueIsClosedV2(handle=handle) else: print('Invalid handle provided.')
Conclusion
CVE-2022-29207 is a significant vulnerability in TensorFlow that can lead to undefined behavior when invalid resource handles are used. It is crucial for users to update to the patched versions of TensorFlow to mitigate the risks associated with this vulnerability. Additionally, following best practices when handling resource handles can help prevent such issues.
See every vulnerability recorded for tensorflow-cpu →
FAQ
CVE-2022-29207 is a vulnerability in TensorFlow that arises from undefined behavior when invalid resource handles are supplied to certain operations in eager mode.
The consequences include application crashes and unpredictable behavior, which can severely impact applications that rely on TensorFlow for machine learning tasks.
You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.
TensorFlow versions prior to 2.6.4, 2.7.2, and 2.8.1 are affected by this vulnerability.
You can update TensorFlow to a secure version by running the command: pip install --upgrade tensorflow-cpu.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-cpu.