CVE-2021-29611: TensorFlow Incomplete Validation in SparseReshape
Summary
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
- tensorflow · PyPI
- tensorflow · PyPI
- tensorflow-cpu · PyPI
- tensorflow-gpu · PyPI
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.
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.
No signup required · Results in about 60 seconds
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.42.1.4 -
>= 2.2.0, < 2.2.32.2.3 -
>= 2.3.0, < 2.3.32.3.3 -
>= 2.4.0, < 2.4.22.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 →
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.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.