CVE-2021-29554: TensorFlow - Denial of Service via FPE Runtime Error in tf.raw_ops.DenseCountSparseOutput

tensorflow Updated 02 Oct 2025

Summary

06/03/2024
Yes i
Medium
Not published

CVE-2021-29554: Division by 0 in DenseCountSparseOutput. Affects tensorflow across 4 version ranges.

< 2.1.4 >= 2.2.0, < 2.2.3 >= 2.3.0, < 2.3.3 >= 2.4.0, < 2.4.2

Fixed in 4 releases; the minimum fixed version depends on the release line you run. How to fix ↓

Also tracked for

The same CVE-2021-29554 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 end-to-end open source platform for machine learning. It provides a comprehensive ecosystem for building and deploying machine learning models. TensorFlow is widely used in various industries and research domains for tasks such as image recognition, natural language processing, and recommendation systems. However, a vulnerability has been discovered in TensorFlow that can lead to a denial of service attack.

Vulnerability Detail

The vulnerability (CVE-2021-29554) in TensorFlow is caused by a flaw in the implementation of the tf.raw_ops.DenseCountSparseOutput function. An attacker can trigger a runtime error related to fixed-point encoding (FPE) by providing malicious input. The implementation fails to check if the divisor value computed from user data is zero before performing division, leading to a runtime error. This vulnerability can be exploited to cause a denial of service attack by crashing the TensorFlow application. The issue affects versions 0 and 2.1.4 of TensorFlow, as well as versions 2.2.0 to 2.2.3, 2.3.0 to 2.3.3, and 2.4.0 to 2.4.2. The vulnerability has a CVSSv3 severity score of 6.5 (Medium).

How To Fix

Fixed versions by release line

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

  • < 2.1.4 2.1.4
  • >= 2.2.0, < 2.2.3 2.2.3
  • >= 2.3.0, < 2.3.3 2.3.3
  • >= 2.4.0, < 2.4.2 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

No workaround has been provided for this vulnerability.

Conclusion

The vulnerability in TensorFlow (CVE-2021-29554) can be exploited to cause a denial of service attack. Users of affected versions should upgrade to the latest available version or apply the backported fixes. 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 for building and deploying machine learning models.

The vulnerability in TensorFlow can be exploited to cause a denial of service attack by crashing the application.

The vulnerability affects versions 0 and 2.1.4 of TensorFlow, as well as versions 2.2.0 to 2.2.3, 2.3.0 to 2.3.3, and 2.4.0 to 2.4.2.

The vulnerability has a CVSSv3 severity score of 6.5 (Medium).

To fix the vulnerability, it is recommended to upgrade TensorFlow to version 2.5.0 or apply the backported fixes for versions 2.4.2 and 2.3.3.

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.1.4 2.1.4
  • >= 2.2.0, < 2.2.3 2.2.3
  • >= 2.3.0, < 2.3.3 2.3.3
  • >= 2.4.0, < 2.4.2 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