CVE-2022-21732: Memory Exhaustion in TensorFlow

tensorflow Updated 02 Oct 2025

Summary

10/02/2022
Yes i
Moderate
4.3

CVE-2022-21732: 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-21732 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 MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

TensorFlow is an open-source machine learning framework developed by Google. It provides a comprehensive ecosystem of tools, libraries, and resources for building and deploying machine learning models. TensorFlow is widely used in various domains, including research, industry, and academia. However, a vulnerability has been discovered in TensorFlow that can lead to memory exhaustion and potential denial of service attacks.

Vulnerability Detail

The vulnerability in TensorFlow lies in the implementation of the ThreadPoolHandle function. By providing a large value for the num_threads argument, an attacker can trigger a memory exhaustion attack. The num_threads argument is only checked for negativity, allowing an attacker to allocate an excessive amount of memory. This vulnerability can be exploited to cause a denial of service by consuming all available memory resources on the affected system.

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

As a temporary workaround, users can limit the number of threads used by the ThreadPoolHandle function to mitigate the risk of memory exhaustion. This can be achieved by specifying a smaller value for the num_threads argument when invoking the function. However, this workaround may impact the performance of TensorFlow applications that rely on parallel processing.

Conclusion

The vulnerability in TensorFlow can lead to memory exhaustion and denial of service attacks. Users are advised to update their TensorFlow installation to one of the patched versions (2.5.3, 2.6.3, 2.7.1, or 2.8.0) to fix the vulnerability. Alternatively, a temporary workaround of limiting the number of threads can be applied. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for tensorflow →

Share this vulnerability

FAQ

The vulnerability allows an attacker to exhaust the memory resources of a system running TensorFlow, leading to a denial of service condition. This can disrupt the normal operation of TensorFlow applications and potentially impact the availability of other services running on the same system.

You can use the Vulert Playground (https://vulert.com/scanner) to check if your TensorFlow installation is affected by this vulnerability. Simply provide your Pipfile.lock file, and Vulert will analyze it for any known vulnerabilities, including this one.

No, not all versions of TensorFlow are affected. The vulnerability exists in TensorFlow versions 2.5.3, 2.6.3, 2.7.1, and prior. The issue has been addressed in TensorFlow 2.8.0 and the aforementioned patched versions.

There are no known public exploits for this vulnerability at the time of this advisory. However, it is recommended to apply the patches or workarounds as soon as possible to mitigate the risk of potential attacks.

Yes, the temporary workaround of limiting the number of threads used by the ThreadPoolHandle function can be applied without updating TensorFlow. However, it is still recommended to update to the patched versions to ensure comprehensive protection against this 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