CVE-2021-41221: TensorFlow Heap Buffer Overflow

tensorflow Updated 02 Oct 2025

Summary

06/03/2024
Yes i
High
Not published

CVE-2021-41221: Access to invalid memory during shape inference in Cudnn* ops. Affects tensorflow across 3 version ranges.

>= 2.4.0, < 2.4.4 >= 2.5.0, < 2.5.2 >= 2.6.0, < 2.6.1

Fixed in 2.4.4, 2.5.2 or 2.6.1, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2021-41221 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 platform for machine learning. It provides a comprehensive ecosystem of tools, libraries, and resources for developing and deploying machine learning models. TensorFlow is widely used in various industries and research fields for tasks such as image recognition, natural language processing, and predictive analytics. However, a vulnerability has been discovered in TensorFlow that can lead to a heap buffer overflow.

Vulnerability Detail

The vulnerability in TensorFlow lies in the shape inference code for the Cudnn* operations. This code can be tricked into accessing invalid memory, resulting in a heap buffer overflow. The issue arises because the ranks of the input, input_h, and input_c parameters are not properly validated, but the code assumes certain values for them. This can be exploited by an attacker to execute arbitrary code or cause a denial of service. The vulnerability has been assigned CVE-2021-41221 and has a severity rating of High.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • >= 2.4.0, < 2.4.4 2.4.4
  • >= 2.5.0, < 2.5.2 2.5.2
  • >= 2.6.0, < 2.6.1 2.6.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 of now, there is no known workaround for this vulnerability. It is recommended to apply the official patch or upgrade to the latest patched version of TensorFlow as soon as it is released.

Conclusion

The vulnerability in TensorFlow can lead to a heap buffer overflow, potentially allowing an attacker to execute arbitrary code or cause a denial of service. It is important to stay updated with the latest patched version of TensorFlow to mitigate the risk. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for tensorflow →

Share this vulnerability

FAQ

TensorFlow is an open source platform for machine learning that provides a comprehensive ecosystem of tools and resources for developing and deploying machine learning models.

A heap buffer overflow is a type of vulnerability where a program writes data beyond the allocated memory buffer, potentially overwriting important data or executing arbitrary code.

This vulnerability can be exploited by tricking the shape inference code in TensorFlow into accessing invalid memory, leading to a heap buffer overflow. An attacker can use this to execute arbitrary code or cause a denial of service.

This vulnerability has a severity rating of High.

To protect your system, it is recommended to upgrade to the latest patched version of TensorFlow as soon as it becomes available. Regularly updating your TensorFlow installation is crucial to mitigate the risk of this vulnerability.

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • >= 2.4.0, < 2.4.4 2.4.4
  • >= 2.5.0, < 2.5.2 2.5.2
  • >= 2.6.0, < 2.6.1 2.6.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