CVE-2021-41222: TensorFlow - Segfault in SplitV with Negative Arguments

tensorflow Updated 02 Oct 2025

Summary

05/11/2021
Yes i
Moderate
5.5

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

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.

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 MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

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.4 2.4.4
    pip install --upgrade "tensorflow==2.4.4"
  • >= 2.5.0, < 2.5.2 2.5.2
    pip install --upgrade "tensorflow==2.5.2"
  • >= 2.6.0, < 2.6.1 2.6.1
    pip install --upgrade "tensorflow==2.6.1"
  • >= 2.7.0rc0, < 2.7.0 2.7.0
    pip 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 →

Share this vulnerability

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]

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow.

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.4 2.4.4
    pip install --upgrade "tensorflow==2.4.4"
  • >= 2.5.0, < 2.5.2 2.5.2
    pip install --upgrade "tensorflow==2.5.2"
  • >= 2.6.0, < 2.6.1 2.6.1
    pip install --upgrade "tensorflow==2.6.1"
  • >= 2.7.0rc0, < 2.7.0 2.7.0
    pip 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 →

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