CVE-2021-41195: TensorFlow - Denial of Service Vulnerability

tensorflow Updated 02 Oct 2025

Summary

06/03/2024
Yes i
Medium
Not published

CVE-2021-41195: Crash in tf.math.segment_* operations. Affects tensorflow across 3 version ranges.

< 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-41195 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 open source platform for machine learning. It provides a comprehensive ecosystem of tools, libraries, and resources for building 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 recommendation systems. However, a vulnerability has been discovered in TensorFlow that can lead to a denial of service (DoS) attack.

Vulnerability Detail

The vulnerability, identified as CVE-2021-41195, affects the implementation of tf.math.segment_* operations in TensorFlow. When a segment id in segment_ids is large, it triggers a CHECK-fail related abort, resulting in a DoS condition. This vulnerability is similar to previously reported vulnerabilities in TensorFlow, such as CVE-2021-29584. The issue arises from the computation of the output shape using AddDim, which can cause a CHECK failure and a subsequent std::abort if the number of elements in the tensor overflows an int64_t value. The impact of this vulnerability is the disruption of TensorFlow-based applications and services, leading to service unavailability.

How To Fix

Fixed versions by release line

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

  • < 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

There is no specific workaround mentioned for this vulnerability.

Conclusion

The vulnerability in TensorFlow can result in a denial of service (DoS) condition, impacting the availability of TensorFlow-based applications and services. It is crucial to update to the latest patched version of TensorFlow to mitigate this vulnerability. For further support on vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for tensorflow →

Share this vulnerability

FAQ

TensorFlow is an open source platform for machine learning, widely used for building and deploying machine learning models.

The vulnerability can lead to a denial of service (DoS) condition, causing disruption to TensorFlow-based applications and services.

To fix this vulnerability, update to the latest patched version of TensorFlow (2.7.0 or backported versions).

No specific workarounds have been mentioned for this vulnerability.

Yes, there are other machine learning frameworks available, such as PyTorch and scikit-learn.

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.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