CVE-2022-35941: TensorFlow AvgPoolOp CHECK Failure Vulnerability
Summary
CVE-2022-35941: TensorFlow vulnerable to CHECK failure in AvgPoolOp. Affects tensorflow across 3 version ranges.
< 2.7.2
>= 2.8.0, < 2.8.1
>= 2.9.0, < 2.9.2
Fixed in 2.7.2, 2.8.1 or 2.9.2, depending on the release line you run. How to fix ↓
Also tracked for
- tensorflow-cpu · PyPI
- tensorflow-gpu · PyPI
- tensorflow · Bitnami
The same CVE-2022-35941 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 library developed by Google, widely used for building and training machine learning models. It provides a flexible ecosystem of tools, libraries, and community resources that allows researchers and developers to create and deploy machine learning applications. The library includes various operations for tensor manipulation, including pooling operations like AvgPoolOp, which is designed to compute the average of elements across specified dimensions. However, a vulnerability has been identified in the AvgPoolOp function that can lead to program crashes under certain conditions.
Vulnerability Detail
The vulnerability arises from the AvgPoolOp function, which takes an argument 'ksize' that must be positive. However, this argument is not properly validated, allowing a negative or excessively large value to be passed. If a negative value is provided, it can trigger a CHECK failure, causing the program to crash unexpectedly. This could lead to denial of service, especially in production environments where stability is critical. The vulnerability was reported by Jingyi Shi and affects multiple versions of 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.7.22.7.2pip install --upgrade "tensorflow==2.7.2" -
>= 2.8.0, < 2.8.12.8.1pip install --upgrade "tensorflow==2.8.1" -
>= 2.9.0, < 2.9.22.9.2pip install --upgrade "tensorflow==2.9.2"
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, avoid using negative or excessively large values for the 'ksize' parameter in the AvgPoolOp function. Here is an example of how to use the AvgPoolOp correctly:
import tensorflow as tf import numpy as np
value = np.ones([1, 1, 1, 1]) ksize = [1, 1, 1, 1] # Ensure ksize values are positive strides = [1, 1, 1, 1] padding = 'SAME' data_format = 'NHWC'
tf.raw_ops.AvgPool(value=value, ksize=ksize, strides=strides, padding=padding, data_format=data_format)
Conclusion
The CVE-2022-35941 vulnerability in TensorFlow's AvgPoolOp function poses a risk of program crashes due to unchecked input parameters. It is crucial to update to the patched versions or implement workarounds to maintain application stability. Regular monitoring for vulnerabilities using tools like Vulert can help ensure your software remains secure.
See every vulnerability recorded for tensorflow →
FAQ
CVE-2022-35941 is a vulnerability in TensorFlow's AvgPoolOp function that can lead to program crashes due to unchecked input parameters.
The vulnerability can cause a CHECK failure and crash the program if a negative or excessively large value is passed to the 'ksize' parameter.
The vulnerability affects TensorFlow versions prior to 2.7.2, 2.8.1, and 2.9.2.
You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Visit Vulert Scanner to check if your application is affected without needing to sign up.
As a temporary measure, ensure that you do not use negative or excessively large values for the 'ksize' parameter in the AvgPoolOp function.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.