CVE-2021-29514: Heap out of bounds write in tensorflow

tensorflow Updated 02 Oct 2025

Summary

21/05/2021
Yes i
Low
2.5

CVE-2021-29514: Heap out of bounds write in RaggedBinCount. Affects tensorflow across 2 version ranges.

>= 2.3.0, < 2.3.3 >= 2.4.0, < 2.4.2

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

Also tracked for

The same CVE-2021-29514 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 Penetration testing for web, API and mobile 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 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 could potentially lead to a heap buffer overflow.

Vulnerability Detail

The vulnerability, identified as CVE-2021-29514, exists in the RaggedBincount function of TensorFlow. If the splits argument of RaggedBincount does not specify a valid SparseTensor, an attacker can trigger a heap buffer overflow. By exploiting this vulnerability, an attacker can cause a read from outside the bounds of the splits tensor buffer, leading to potential code execution or information disclosure.

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.3.0, < 2.3.3 2.3.3
    pip install --upgrade "tensorflow==2.3.3"
  • >= 2.4.0, < 2.4.2 2.4.2
    pip install --upgrade "tensorflow==2.4.2"

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 apply the patches or update to the patched versions of TensorFlow as mentioned in the 'how_to_fix' section.

Conclusion

The vulnerability in TensorFlow can be mitigated by updating to the patched versions or applying the provided patches. It is crucial to keep software dependencies up to date to ensure the security of machine learning models and applications. 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 machine learning framework developed by Google. It provides a comprehensive ecosystem of tools, libraries, and resources for building and deploying machine learning models.

The vulnerability allows an attacker to trigger a heap buffer overflow, potentially leading to code execution or information disclosure.

To fix this vulnerability, it is recommended to update TensorFlow to version 2.5.0 or apply the provided patches.

There are no known workarounds for this vulnerability. It is recommended to update to the patched versions of TensorFlow.

For more information, please refer to the TensorFlow security guide and the GitHub commit mentioned in the 'how_to_fix' section.

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.3.0, < 2.3.3 2.3.3
    pip install --upgrade "tensorflow==2.3.3"
  • >= 2.4.0, < 2.4.2 2.4.2
    pip install --upgrade "tensorflow==2.4.2"

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