CVE-2022-21740: Heap Overflow in TensorFlow

tensorflow-cpu Updated 02 Oct 2025

Summary

03/02/2022
Yes i
Unrated
Not published

CVE-2022-21740: Tensorflow is an Open Source Machine Learning Framework. Affects tensorflow-cpu across 4 version ranges.

< 2.5.3 >= 2.6.0, < 2.6.3 < 2b7100d6cdff36aa21010a82269bc05a6d1cc74a < adbbabdb0d3abb3cdeac69e38a96de1d678b24b3

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

Also tracked for

The same CVE-2022-21740 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 widely used for developing and deploying machine learning models. It provides a comprehensive set of tools and libraries for building and training neural networks. TensorFlow is vulnerable to a heap overflow in the implementation of SparseCountSparseOutput.

Vulnerability Detail

The vulnerability in TensorFlow allows an attacker to trigger a heap overflow, potentially leading to remote code execution or denial of service. This vulnerability can be exploited by crafting a malicious input that triggers the overflow during the execution of the affected function. The issue has been identified and fixed in TensorFlow 2.8.0. However, earlier versions including TensorFlow 2.7.1, TensorFlow 2.6.3, and TensorFlow 2.5.3 are also affected.

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

There is no known workaround for this vulnerability. It is recommended to update to the fixed versions of TensorFlow as mentioned above.

Conclusion

TensorFlow is vulnerable to a heap overflow, which can be exploited to execute arbitrary code or cause a denial of service. It is crucial to update to the fixed versions of TensorFlow or apply the provided patches to mitigate this vulnerability. For further support on vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for tensorflow-cpu →

Share this vulnerability

FAQ

TensorFlow is an open-source machine learning framework used for building and training neural networks.

A heap overflow is a type of buffer overflow vulnerability where data is written beyond the allocated memory buffer, potentially leading to code execution or denial of service.

This vulnerability can be exploited by an attacker to execute arbitrary code or cause a denial of service on systems running vulnerable versions of TensorFlow.

The vulnerability affects TensorFlow versions 2.5.3, 2.6.3, 2.7.1, and earlier. It has been fixed in TensorFlow 2.8.0.

To update TensorFlow, you can use the package manager or follow the installation instructions provided by the TensorFlow project.

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow-cpu.

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

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