CVE-2021-41222: TensorFlow GPU - Segfault in SplitV Implementation
Summary
CVE-2021-41222: TensorFlow is an open source platform for machine learning. Affects tensorflow-gpu across 5 version ranges.
< 2.4.4
>= 2.5.0, < 2.5.2
>= 2.6.0, < 2.6.1
>= 2.7.0rc0, < 2.7.0
< 25d622ffc432acc736b14ca3904177579e733cc6
Fixed in 4 releases; the minimum fixed version depends on the release line you run. How to fix ↓
Also tracked for
- tensorflow · Bitnami
- tensorflow · PyPI
- tensorflow · PyPI
- tensorflow-cpu · 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 GPU is a variant of TensorFlow that leverages GPU acceleration for faster computation. It is widely used in various domains, including research, industry, and academia.
Vulnerability Detail
The vulnerability (CVE-2021-41222) exists in the implementation of the SplitV function in TensorFlow GPU. When negative arguments are supplied to SplitV, a segmentation fault (segfault) can be triggered. This occurs when the size_splits parameter contains more than one value and at least one of those values is negative. An attacker can exploit this vulnerability to cause a denial-of-service (DoS) condition or potentially execute arbitrary code on the affected system. The vulnerability affects multiple versions of TensorFlow GPU, including 2.4.4, 2.5.2, 2.6.1, and 2.7.0rc0.
How To Fix
Latest published version: 2.12.0 as of 22 Oct 2026
pip install --upgrade "tensorflow-gpu==2.12.0"
Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.
If you can't move to the latest
The minimum fixed version depends on the release line you run.
-
< 2.4.42.4.4pip install --upgrade "tensorflow-gpu==2.4.4" -
>= 2.5.0, < 2.5.22.5.2pip install --upgrade "tensorflow-gpu==2.5.2" -
>= 2.6.0, < 2.6.12.6.1pip install --upgrade "tensorflow-gpu==2.6.1" -
>= 2.7.0rc0, < 2.7.02.7.0pip install --upgrade "tensorflow-gpu==2.7.0"
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, users can avoid supplying negative arguments to the SplitV function in TensorFlow GPU. It is recommended to validate and sanitize input values before passing them to the function. Here is an example of how to perform input validation in Python:
size_splits = [10, -5, 8]
# 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)
Conclusion
In conclusion, the vulnerability (CVE-2021-41222) in TensorFlow GPU's SplitV function can be exploited by supplying negative arguments, leading to a segfault and potential security risks. It is crucial to update to the latest version of TensorFlow GPU (2.7.0) or apply the respective fixes for earlier versions (2.6.1, 2.5.2, and 2.4.4) to mitigate this vulnerability. Regularly monitoring and updating software dependencies is essential to ensure the security and stability of machine learning systems.
See every vulnerability recorded for tensorflow-gpu →
FAQ
TensorFlow GPU is a variant of TensorFlow that utilizes GPU acceleration for faster machine learning computations. It is commonly used in scenarios where large-scale data processing and complex model training are required.
SplitV is a function in TensorFlow GPU that allows splitting a tensor into multiple sub-tensors along a specified dimension. It is commonly used in various machine learning tasks, such as data partitioning and parallel processing.
An attacker can exploit this vulnerability by supplying negative arguments to the SplitV function in TensorFlow GPU. This can lead to a segfault, causing a denial-of-service (DoS) condition or potentially enabling the execution of arbitrary code on the affected system.
The vulnerability affects TensorFlow GPU versions 2.4.4, 2.5.2, 2.6.1, and 2.7.0rc0. It is recommended to update to version 2.7.0 or apply the respective fixes for versions 2.6.1, 2.5.2, and 2.4.4.
To upgrade TensorFlow GPU, follow the official upgrade instructions provided by the TensorFlow project. Ensure that all dependencies and requirements are met during the upgrade process to avoid any compatibility issues.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-gpu.