CVE-2021-29563: TensorFlow RFFT CHECK-fail Vulnerability
Summary
CVE-2021-29563: CHECK-fail in tf.raw_ops.RFFT. Affects tensorflow across 4 version ranges.
< 2.1.4
>= 2.2.0, < 2.2.3
>= 2.3.0, < 2.3.3
>= 2.4.0, < 2.4.2
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-29563 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 machine learning framework developed by Google. It provides a comprehensive ecosystem of tools, libraries, and resources for building and deploying machine learning models. TensorFlow includes a module called tf.raw_ops.RFFT which performs the fast Fourier transform on input data. This module is used in various applications for signal processing and image analysis. However, a vulnerability has been discovered in the implementation of tf.raw_ops.RFFT that can lead to a denial of service (DoS) attack.
Vulnerability Detail
The vulnerability, identified as CVE-2021-29563, arises from a CHECK-failure in the tf.raw_ops.RFFT function. An attacker can exploit this vulnerability by providing specific input values that cause the Eigen code to operate on an empty matrix. This triggers an assertion and results in the termination of the program. The impact of this vulnerability is a DoS condition, where the affected TensorFlow application becomes unresponsive and fails to perform the expected computations.
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.1.42.1.4pip install --upgrade "tensorflow==2.1.4" -
>= 2.2.0, < 2.2.32.2.3pip install --upgrade "tensorflow==2.2.3" -
>= 2.3.0, < 2.3.32.3.3pip install --upgrade "tensorflow==2.3.3" -
>= 2.4.0, < 2.4.22.4.2pip install --upgrade "tensorflow==2.4.2"
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 validate the input data before passing it to the tf.raw_ops.RFFT function. By ensuring that the input data is not empty or invalid, the vulnerability can be mitigated. Here is an example of how to perform input validation in Python:
import tensorflow as tf
inputs = tf.constant([1], shape=[1], dtype=tf.float32)
fft_length = tf.constant([0], shape=[1], dtype=tf.int32)
if inputs.shape[0] > 0 and fft_length.shape[0] > 0:
tf.raw_ops.RFFT(input=inputs, fft_length=fft_length)
else:
print('Invalid input data')
By checking the shape of the input tensors, the vulnerability can be avoided.
Conclusion
The TensorFlow RFFT CHECK-fail vulnerability (CVE-2021-29563) can lead to a denial of service (DoS) attack in TensorFlow applications. It is crucial to update to the patched versions of TensorFlow or apply input validation as a workaround. For further assistance and support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
The vulnerability can result in a denial of service (DoS) condition, causing the affected TensorFlow application to become unresponsive and fail to perform the expected computations.
To fix the vulnerability, update your TensorFlow installation to one of the patched versions: TensorFlow 2.5.0, TensorFlow 2.4.2, TensorFlow 2.3.3, TensorFlow 2.2.3, or TensorFlow 2.1.4.
Yes, you can validate the input data before passing it to the tf.raw_ops.RFFT function to mitigate the vulnerability. Ensure that the input data is not empty or invalid.
Yes, the vulnerability affects TensorFlow versions 2.1.4, 2.2.3, 2.3.3, 2.4.2, and 2.5.0. Earlier versions may also be affected.
The vulnerability was reported by Yakun Zhang and Ying Wang of Baidu X-Team.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.