CVE-2021-29556: TensorFlow Reverse FPE Runtime Error Denial of Service

tensorflow-cpu Updated 02 Oct 2025

Summary

14/05/2021
Yes i
Unrated
Not published

CVE-2021-29556: TensorFlow is an end-to-end open source platform for machine learning. Affects tensorflow-cpu across 5 version ranges.

>= 2.2.0, < 2.3.0rc0 < 2.2.0rc0 >= 2.3.0, < 2.3.4 >= 2.4.0, < 2.4.3 < 4071d8e2f6c45c1955a811fee757ca2adbe462c1

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-29556 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 Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

TensorFlow is an end-to-end 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 industries and research domains for tasks such as image recognition, natural language processing, and recommendation systems. However, a vulnerability has been discovered in TensorFlow that can lead to a denial of service (DoS) attack.

Vulnerability Detail

The vulnerability (CVE-2021-29556) in TensorFlow is caused by a runtime error in the tf.raw_ops.Reverse function. An attacker can exploit this vulnerability to trigger a division based on the first dimension of the tensor argument, leading to a FPE (Floating Point Exception) error. This error can cause the TensorFlow runtime to crash, resulting in a denial of service. The vulnerability affects multiple versions of TensorFlow, including 2.1.4, 2.2.3, 2.3.3, 2.4.2, and prior versions. The issue has been identified and a fix will be included in TensorFlow 2.5.0.

How To Fix

Latest published version: 2.21.0 as of 22 Oct 2026

pip install --upgrade "tensorflow-cpu==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.2.0rc0 2.2.0rc0
    pip install --upgrade "tensorflow-cpu==2.2.0rc0"
  • >= 2.2.0, < 2.3.0rc0 2.3.0rc0
    pip install --upgrade "tensorflow-cpu==2.3.0rc0"
  • >= 2.3.0, < 2.3.4 2.3.4
    pip install --upgrade "tensorflow-cpu==2.3.4"
  • >= 2.4.0, < 2.4.3 2.4.3
    pip install --upgrade "tensorflow-cpu==2.4.3"

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 avoid using the tf.raw_ops.Reverse function in their TensorFlow code. By replacing this function with alternative approaches or custom implementations, the vulnerability can be mitigated. Here is an example of a workaround using a custom reverse function:

import tensorflow as tf

# Custom reverse function
@tf.function
def custom_reverse(tensor):
    return tf.reverse(tensor, axis=[0])

# Usage
input_tensor = tf.constant([1, 2, 3, 4, 5])
reversed_tensor = custom_reverse(input_tensor)

Conclusion

The vulnerability in TensorFlow (CVE-2021-29556) can be exploited to cause a denial of service by triggering a FPE runtime error. It is crucial to update TensorFlow to version 2.5.0 or apply the provided patches for the affected versions (2.4.2, 2.3.3, 2.2.3, and 2.1.4) once they are released. In the meantime, users can implement the suggested workaround to mitigate the vulnerability. For further support on vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for tensorflow-cpu →

Share this vulnerability

FAQ

TensorFlow is an open source platform for machine learning that provides tools and libraries for developing and deploying machine learning models.

This vulnerability in TensorFlow can lead to a denial of service (DoS) attack, causing the TensorFlow runtime to crash and rendering the system unavailable.

The vulnerability affects TensorFlow versions 2.1.4, 2.2.3, 2.3.3, 2.4.2, and prior versions.

Yes, a fix for this vulnerability will be included in TensorFlow 2.5.0. Patches for the affected versions (2.4.2, 2.3.3, 2.2.3, and 2.1.4) will also be provided.

As a temporary workaround, you can avoid using the tf.raw_ops.Reverse function in your TensorFlow code. Replace it with alternative approaches or custom implementations.

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow-cpu.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Latest published version: 2.21.0 as of 22 Oct 2026

pip install --upgrade "tensorflow-cpu==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.2.0rc0 2.2.0rc0
    pip install --upgrade "tensorflow-cpu==2.2.0rc0"
  • >= 2.2.0, < 2.3.0rc0 2.3.0rc0
    pip install --upgrade "tensorflow-cpu==2.3.0rc0"
  • >= 2.3.0, < 2.3.4 2.3.4
    pip install --upgrade "tensorflow-cpu==2.3.4"
  • >= 2.4.0, < 2.4.3 2.4.3
    pip install --upgrade "tensorflow-cpu==2.4.3"

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