CVE-2022-21733: Denial of Service Vulnerability in tensorflow-gpu
Summary
CVE-2022-21733: Tensorflow is an Open Source Machine Learning Framework. Affects tensorflow-gpu across 3 version ranges.
< 2.5.3
>= 2.6.0, < 2.6.3
< f68fdab93fb7f4ddb4eb438c8fe052753c9413e8
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-cpu · PyPI
The same CVE-2022-21733 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 training machine learning models. It provides a comprehensive set of tools and libraries for building and deploying machine learning applications. The tensorflow-gpu package is a variant of TensorFlow that leverages GPU acceleration for faster computation. This vulnerability affects versions of tensorflow-gpu up to 2.5.3, 2.6.3, and 2.7.1.
Vulnerability Detail
The vulnerability in tensorflow-gpu arises from an integer overflow issue in the implementation of the StringNGrams function. The function fails to validate the pad_width parameter, leading to a negative value for ngram_width. This negative value is later used to allocate parts of the output, causing an out-of-memory condition and triggering a denial of service attack. An attacker can exploit this vulnerability by providing malicious input to the affected function, potentially leading to a complete system crash or unresponsive behavior. The issue has been identified and fixed in TensorFlow 2.8.0, and patches have been backported to versions 2.5.3, 2.6.3, and 2.7.1.
How To Fix
Latest published version: 2.12.0 as of 22 Oct 2026
pip install --upgrade "tensorflow-gpu==2.12.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-gpu==2.5.3" -
>= 2.6.0, < 2.6.32.6.3pip install --upgrade "tensorflow-gpu==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 temporary workaround, you can avoid using the StringNGrams function in tensorflow-gpu or restrict its usage to trusted inputs. By avoiding the function or carefully validating the input, you can mitigate the risk of triggering the vulnerability. However, applying the official patches or upgrading to TensorFlow 2.8.0 is strongly recommended for a complete resolution.
Conclusion
The vulnerability in tensorflow-gpu can be exploited to trigger a denial of service attack by causing an out-of-memory condition. It is crucial to upgrade to TensorFlow 2.8.0 or apply the provided patches to ensure the security and stability of your machine learning applications. For further assistance or support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow-gpu →
FAQ
TensorFlow is an open-source machine learning framework used for developing and training machine learning models. It provides a wide range of tools and libraries for building and deploying machine learning applications.
The tensorflow-gpu package is a variant of TensorFlow that leverages GPU acceleration for faster computation. It is specifically designed to utilize the computational power of GPUs to speed up machine learning tasks.
The vulnerability in tensorflow-gpu can be exploited by an attacker to trigger a denial of service attack. By providing malicious input to the StringNGrams function, an attacker can cause an out-of-memory condition, leading to system crashes or unresponsive behavior.
No, only versions up to 2.5.3, 2.6.3, and 2.7.1 of tensorflow-gpu are affected by this vulnerability. The issue has been fixed in TensorFlow 2.8.0, and patches have been backported to the affected versions.
To protect your system, it is recommended to upgrade to TensorFlow 2.8.0 or later. If you are using an affected version, apply the provided patches to address the vulnerability. Additionally, consider restricting the usage of the StringNGrams function or carefully validating its input.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-gpu.