CVE-2021-41222: TensorFlow - Segfault in SplitV Implementation
Summary
CVE-2021-41222: Segfault due to negative splits in SplitV. Affects tensorflow across 3 version ranges.
>= 2.4.0, < 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
- tensorflow · PyPI
- tensorflow · PyPI
- tensorflow-cpu · PyPI
- tensorflow-gpu · PyPI
The same CVE-2021-41222 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 open source platform for machine learning. It provides a comprehensive ecosystem of tools, libraries, and resources for developing and deploying machine learning models. TensorFlow is widely used in various domains, including research, industry, and academia. It offers efficient computation and supports distributed computing, making it suitable for large-scale machine learning tasks. However, a vulnerability has been discovered in TensorFlow that can lead to a segmentation fault (segfault) when certain negative arguments are supplied to the SplitV function.
Vulnerability Detail
The vulnerability (CVE-2021-41222) arises from a flaw in the implementation of the SplitV function in TensorFlow. When the size_splits parameter contains multiple values and at least one of them is negative, it can trigger a segfault. This vulnerability can be exploited by an attacker to cause a denial of service (DoS) condition or potentially execute arbitrary code. The impact of this vulnerability depends on the context in which TensorFlow is used, but it can potentially disrupt machine learning workflows and compromise the integrity of the system.
How To Fix
Fixed versions by release line
The minimum fixed version depends on the release line you run.
-
>= 2.4.0, < 2.4.42.4.4 -
>= 2.5.0, < 2.5.22.5.2 -
>= 2.6.0, < 2.6.12.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
As a temporary workaround, users can avoid supplying negative values in the size_splits parameter of the SplitV function. It is crucial to validate and sanitize input data to prevent any negative values from being passed to this function. Here is an example of how to perform input validation in Python:
size_splits = [10, -5, 20]
# Validate input
if any(split < 0 for split in size_splits):
raise ValueError('Negative values not allowed in size_splits')
# Call SplitV function
result = tf.split(size_splits=size_splits, ...)
By ensuring that only non-negative values are used, the vulnerability can be mitigated until the TensorFlow library is updated.
Conclusion
The vulnerability in TensorFlow's SplitV function can lead to a segfault when negative arguments are supplied. This can have various consequences, including a denial of service condition or potential code execution. It is crucial for users of TensorFlow to update their installations to the latest patched version as soon as it becomes available. In the meantime, implementing input validation and avoiding negative values in the size_splits parameter can serve as a temporary workaround. For further support and guidance on vulnerability remediation, please reach out to DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open source platform for machine learning that provides tools and libraries for developing and deploying machine learning models.
The vulnerability can lead to a segmentation fault (segfault) in TensorFlow, potentially causing a denial of service (DoS) condition or enabling arbitrary code execution.
The vulnerability affects TensorFlow versions 2.4.0 to 2.4.4, 2.5.0 to 2.5.2, 2.6.0 to 2.6.1, as well as the pre-release versions 2.7.0-rc0 and 2.7.0-rc1.
To fix the vulnerability, it is recommended to update TensorFlow to the latest patched version once it becomes available. The TensorFlow development team has backported the fix to earlier versions as well.
Yes, as a temporary workaround, users can ensure that no negative values are supplied in the size_splits parameter of the SplitV function. Input validation and sanitization can help prevent the vulnerability from being exploited.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.