CVE-2021-41222: TensorFlow - Segfault in SplitV with Negative Arguments
Summary
CVE-2021-41222: TensorFlow is an open source platform for machine learning. Affects tensorflow 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-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 computer vision, natural language processing, and deep learning. It offers a flexible architecture that allows users to build and train machine learning models using high-level APIs or by directly manipulating tensors. However, a vulnerability has been discovered in TensorFlow that can lead to a segmentation fault (segfault) under certain conditions.
Vulnerability Detail
The vulnerability, identified as CVE-2021-41222, resides in the implementation of the SplitV function in TensorFlow. When the function is called with negative arguments in the size_splits parameter, a segfault can occur. This issue specifically arises when size_splits contains multiple values and at least one of them is negative. An attacker can exploit this vulnerability by supplying malicious input to trigger the segfault. The impact of this vulnerability can range from denial of service (DoS) to potential remote code execution, depending on the context in which TensorFlow is used. The vulnerability has been addressed in TensorFlow versions 2.7.0, 2.6.1, 2.5.2, and 2.4.4.
How To Fix
Latest published version: 2.21.0 as of 22 Oct 2026
pip install --upgrade "tensorflow==2.21.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==2.4.4" -
>= 2.5.0, < 2.5.22.5.2pip install --upgrade "tensorflow==2.5.2" -
>= 2.6.0, < 2.6.12.6.1pip install --upgrade "tensorflow==2.6.1" -
>= 2.7.0rc0, < 2.7.02.7.0pip install --upgrade "tensorflow==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 temporary workaround, users can ensure that the size_splits parameter does not contain any negative values when calling the SplitV function. This can be achieved by validating the input and rejecting any negative values. Here is an example of how to perform this validation in Python:
def safe_splitv(size_splits):
if any(split < 0 for split in size_splits):
raise ValueError('Negative values are not allowed in size_splits')
# Call SplitV function with validated size_splits
...
Conclusion
In conclusion, TensorFlow is affected by a vulnerability in the SplitV function that can lead to a segfault when negative arguments are provided. This vulnerability has been addressed in TensorFlow versions 2.7.0, 2.6.1, 2.5.2, and 2.4.4. Users are advised to update their TensorFlow installation to one of these patched versions to mitigate the risk. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open source platform for machine learning that provides tools and resources for developing and deploying machine learning models.
The impact of this vulnerability can range from denial of service (DoS) to potential remote code execution, depending on the context in which TensorFlow is used.
To fix this vulnerability, it is recommended to update TensorFlow to one of the patched versions: 2.7.0, 2.6.1, 2.5.2, or 2.4.4.
Yes, a temporary workaround is to ensure that the size_splits parameter does not contain any negative values when calling the SplitV function.
You can find more information about this vulnerability in the official TensorFlow advisory: [link to advisory]
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.