CVE-2021-29611: TensorFlow Incomplete Validation in SparseReshape

tensorflow Updated 02 Oct 2025

Summary

06/03/2024
Yes i
Medium
Not published

CVE-2021-29611: Incomplete validation in SparseReshape. 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-29611 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 end-to-end open source platform for machine learning. It provides a comprehensive ecosystem of tools, libraries, and resources for developing and deploying machine learning models. TensorFlow supports various operations, including reshaping sparse tensors. However, a vulnerability in the SparseReshape operation allows for incomplete validation of input arguments, leading to a denial of service based on a CHECK-failure.

Vulnerability Detail

The vulnerability arises from the lack of validation in the SparseReshape implementation. This means that the input arguments specifying a sparse tensor are not properly checked for validity. As a result, an attacker could craft malicious input that triggers a CHECK-failure, causing a denial of service. The impact of this vulnerability is a potential disruption of TensorFlow-based machine learning systems. The issue has been assigned the identifier CVE-2021-29611 and has a CVSSv3 score of 6.5 (Medium severity).

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

As a workaround, you can validate the input arguments manually before passing them to the SparseReshape operation. Ensure that the specified sparse tensor is valid and meets the required criteria. Here is an example of how you can perform this validation in Python:

import tensorflow as tf

def validate_sparse_tensor(sparse_tensor):
    if not isinstance(sparse_tensor, tf.SparseTensor):
        raise ValueError('Input is not a sparse tensor.')
    # Perform additional validation checks as needed

# Usage
sparse_tensor = ...
validate_sparse_tensor(sparse_tensor)

Conclusion

The vulnerability in TensorFlow's SparseReshape operation can lead to a denial of service attack. It is recommended to upgrade to TensorFlow 2.5.0 or later, or consider upgrading to TensorFlow 2.4.2 or TensorFlow 2.3.3 if the latest version is not feasible. Additionally, you can manually validate the input arguments as a workaround. For further assistance or support in 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.

The vulnerability allows for a denial of service attack, potentially disrupting TensorFlow-based machine learning systems.

To fix this vulnerability, upgrade to TensorFlow 2.5.0 or later. Alternatively, you can upgrade to TensorFlow 2.4.2 or TensorFlow 2.3.3, which have the fix backported.

Yes, you can manually validate the input arguments before using the SparseReshape operation. Ensure that the specified sparse tensor is valid.

You can find more information about this vulnerability in the official TensorFlow documentation and the CVE entry.

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