CVE-2022-21734: TensorFlow CHECK Failures Due to Non-Scalar Key Tensors

tensorflow Updated 18 Jul 2026

Summary

09/07/2026
Yes i
High
6.5

CVE-2022-21734: CHECK-failures in Tensorflow. Affects tensorflow across 3 version ranges.

< 2.5.3 >= 2.6.0, < 2.6.3 >= 2.7.0, < 2.7.1

Fixed in 2.5.3, 2.6.3 or 2.7.1, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2022-21734 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 machine learning framework that provides a comprehensive ecosystem for building and deploying machine learning models. It is widely used for its flexibility and scalability, allowing developers to create complex neural networks and perform various computations efficiently. However, like any software, TensorFlow is susceptible to vulnerabilities that can affect its functionality and security. This specific vulnerability arises from the implementation of the MapStage operation, which can lead to unexpected behavior if the key tensor is not a scalar.

Vulnerability Detail

The vulnerability in TensorFlow is caused by a CHECK failure in the MapStage operation when the key tensor is not a scalar. This can lead to application crashes or undefined behavior, potentially compromising the integrity of the application using TensorFlow. The issue originates from the way the MapStage operation validates its input parameters, specifically the key tensor. If a non-scalar tensor is provided, it triggers a CHECK failure, which can disrupt the execution of the program. This vulnerability affects multiple versions of TensorFlow, making it critical for users to address it promptly.

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.5.3 2.5.3
    pip install --upgrade "tensorflow==2.5.3"
  • >= 2.6.0, < 2.6.3 2.6.3
    pip install --upgrade "tensorflow==2.6.3"
  • >= 2.7.0, < 2.7.1 2.7.1
    pip install --upgrade "tensorflow==2.7.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 workaround, ensure that the key tensor passed to the MapStage operation is always a scalar. For example, instead of passing a non-scalar tensor, use the following code:

import tensorflow as tf import numpy as np

tf.raw_ops.MapStage( key=tf.constant(value=4, dtype=tf.int64), # Ensure key is a scalar indices=np.array([[6]]), values=np.array([-60]), dtypes=[tf.int64], capacity=0, memory_limit=0, container='', shared_name='', name=None

)

Conclusion

The CHECK failure vulnerability in TensorFlow's MapStage operation poses a risk to applications using non-scalar key tensors. It is crucial for users to update to the patched versions of TensorFlow to mitigate this risk. By following the provided steps and workarounds, developers can ensure their applications remain secure.

See every vulnerability recorded for tensorflow →

Share this vulnerability

FAQ

The vulnerability can lead to application crashes or undefined behavior when a non-scalar key tensor is used in the MapStage operation.

The vulnerability affects TensorFlow versions prior to 2.8.0, including 2.5.3, 2.6.0, and 2.7.0.

You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Visit Vulert Scanner to check if your application is affected without any signup.

As a temporary measure, ensure that the key tensor used in the MapStage operation is a scalar to avoid triggering the CHECK failure.

This vulnerability was reported by Faysal Hossain Shezan from the University of Virginia.

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.5.3 2.5.3
    pip install --upgrade "tensorflow==2.5.3"
  • >= 2.6.0, < 2.6.3 2.6.3
    pip install --upgrade "tensorflow==2.6.3"
  • >= 2.7.0, < 2.7.1 2.7.1
    pip install --upgrade "tensorflow==2.7.1"

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