CVE-2022-21733: TensorFlow Memory Exhaustion Vulnerability

tensorflow Updated 18 Jul 2026

Summary

09/07/2026
Yes i
Moderate
4.3

CVE-2022-21733: Memory exhaustion in Tensorflow. Affects tensorflow across 3 version ranges.

< 2.5.3 >= 2.6.0, < 2.6.3 >= 2.7.0, < 2.7.1

Fixed in 2.5.3, 2.6.3 or 2.7.1, depending on the release line you run. How to fix ↓

Also tracked for

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.

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

TensorFlow is an open-source machine learning library developed by Google. It is widely used for building and training machine learning models, offering a flexible architecture that allows deployment across various platforms. However, TensorFlow has a vulnerability related to its StringNGrams operation, which can lead to memory exhaustion and denial of service attacks.

Vulnerability Detail

The vulnerability arises from the implementation of the StringNGrams operation in TensorFlow, where a lack of validation on the 'pad_width' parameter can lead to an integer overflow. This overflow results in a negative value for 'ngram_width', which is subsequently used to allocate memory for the output. If exploited, this can trigger an out-of-memory (OOM) condition, effectively causing a denial of service. The vulnerability is particularly concerning as it can be triggered with minimal input, making it a potential target for attackers.

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.5.3 2.5.3
    pip install --upgrade "tensorflow==2.5.3"
  • >= 2.6.0, < 2.6.3 2.6.3
    pip install --upgrade "tensorflow==2.6.3"
  • >= 2.7.0, < 2.7.1 2.7.1
    pip install --upgrade "tensorflow==2.7.1"

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

Currently, there are no specific workarounds mentioned for this vulnerability. However, avoiding the use of the StringNGrams operation with invalid parameters may help mitigate the risk until the package is updated.

Conclusion

The CVE-2022-21733 vulnerability in TensorFlow poses a significant risk of memory exhaustion and denial of service. It is crucial for users to update to the patched versions to mitigate this risk. Regular monitoring and updating of dependencies can help maintain the security of applications.

See every vulnerability recorded for tensorflow →

Share this vulnerability

FAQ

CVE-2022-21733 is a vulnerability in TensorFlow that can lead to memory exhaustion and denial of service due to improper validation of the 'pad_width' parameter in the StringNGrams operation.

You can check if your application is affected by using Vulert, which monitors and alerts for open-source vulnerabilities in real-time. You can use the Vulert playground without signup to test your application.

Exploitation of this vulnerability can lead to an out-of-memory condition, causing applications using TensorFlow to crash or become unresponsive, resulting in a denial of service.

You can update TensorFlow by running the command 'pip install --upgrade tensorflow==<version>' in your terminal, replacing '<version>' with 2.5.3, 2.6.3, or 2.7.1.

Yes, patches are available in TensorFlow versions 2.5.3, 2.6.3, and 2.7.1, which address the vulnerability.

Related vulnerabilities

Recent vulnerabilities recorded for 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.5.3 2.5.3
    pip install --upgrade "tensorflow==2.5.3"
  • >= 2.6.0, < 2.6.3 2.6.3
    pip install --upgrade "tensorflow==2.6.3"
  • >= 2.7.0, < 2.7.1 2.7.1
    pip install --upgrade "tensorflow==2.7.1"

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback