CVE-2021-41198: Overflow/crash in tf.tile when tiling tensor is large
Summary
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
- tensorflow · Bitnami
- tensorflow-cpu · PyPI
- tensorflow-gpu · PyPI
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.
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
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.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"
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 →
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.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.