CVE-2021-41198: Overflow/crash in tf.tile when tiling tensor is large

tensorflow Updated 02 Oct 2025

Summary

10/11/2021
Yes i
Moderate
5.5

CVE-2021-41198: Overflow/crash in tf.tile when tiling tensor is large. Affects tensorflow across 3 version ranges.

< 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

The same CVE-2021-41198 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 Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The TensorFlow package is an open-source machine learning framework that provides a wide range of tools and libraries for building and deploying machine learning models. It is widely used in various industries and research fields. The tf.tile function in TensorFlow is used to create a new tensor by tiling an existing tensor along specified dimensions. This allows for the replication of the original tensor's values in the new tensor. However, a vulnerability has been discovered in the tf.tile function that can lead to a crash or overflow when the tiling tensor is large.

Vulnerability Detail

The vulnerability arises when the tf.tile function is called with a large input argument. The number of elements in the output tensor becomes too large for the int64_t type, causing an overflow. This overflow is detected by a CHECK statement, resulting in a process crash. An attacker could potentially exploit this vulnerability to crash TensorFlow processes, leading to denial of service. The impact of this vulnerability is considered moderate with a CVSS score of 5.5.

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"

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 calling the tf.tile function with large input arguments. If tiling a large tensor is necessary, it is recommended to split the tiling operation into smaller chunks and perform them separately. This can help prevent the overflow issue and mitigate the vulnerability. Here is an example of how to split the tiling operation:

import tensorflow as tf
import numpy as np

def split_tile(tensor, n, chunk_size):
    tiled_tensor = np.zeros((1, 1, 1))
    for i in range(0, n, chunk_size):
        chunk = tf.keras.backend.tile(x=tensor, n=[min(chunk_size, n - i), 1, 1])
        tiled_tensor = tf.concat([tiled_tensor, chunk], axis=0)
    return tiled_tensor

large_tensor = np.ones((1, 1, 1))
tiled_tensor = split_tile(large_tensor, 100000000, 1000000)

Conclusion

The overflow/crash vulnerability in the tf.tile function of TensorFlow has been addressed with patches in versions 2.6.1, 2.5.2, and 2.4.4. Users are advised to update their installations to these versions to prevent crashes and potential denial of service. If tiling a large tensor is necessary, it is recommended to use the provided workaround of splitting the tiling operation into smaller chunks. For further support and assistance with vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for tensorflow →

Share this vulnerability

FAQ

TensorFlow is an open-source machine learning framework that provides tools and libraries for building and deploying machine learning models. It is widely used in various industries and research fields.

The tf.tile function in TensorFlow is used to create a new tensor by tiling an existing tensor along specified dimensions. This allows for the replication of the original tensor's values in the new tensor.

The vulnerability can lead to a crash or overflow in TensorFlow processes when the tf.tile function is called with a large input argument. This can result in denial of service.

To fix this vulnerability, users should update their TensorFlow installations to the patched versions (2.6.1, 2.5.2, or 2.4.4). This will prevent the overflow issue in the tf.tile function and mitigate the vulnerability.

Yes, users can avoid calling the tf.tile function with large input arguments. If tiling a large tensor is necessary, it is recommended to split the tiling operation into smaller chunks and perform them separately.

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"

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