CVE-2021-29543: Denial of Service Vulnerability in TensorFlow

tensorflow Updated 02 Oct 2025

Summary

21/05/2021
Yes i
Low
2.5

CVE-2021-29543: CHECK-fail in CTCGreedyDecoder. 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

The same CVE-2021-29543 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 Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

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 is widely used in various domains, including research, industry, and academia. However, a vulnerability has been discovered in TensorFlow that can lead to a denial of service attack.

Vulnerability Detail

The vulnerability, identified as CVE-2021-29543, is a CHECK-fail in the CTCGreedyDecoder component of TensorFlow. This vulnerability allows an attacker to trigger a denial of service by exploiting a condition check failure in the implementation. Specifically, the program aborts instead of returning a valid error when a certain condition is false. This abnormal termination can be weaponized to disrupt the availability of TensorFlow applications.

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.4 2.1.4
    pip install --upgrade "tensorflow==2.1.4"
  • >= 2.2.0, < 2.2.3 2.2.3
    pip install --upgrade "tensorflow==2.2.3"
  • >= 2.3.0, < 2.3.3 2.3.3
    pip install --upgrade "tensorflow==2.3.3"
  • >= 2.4.0, < 2.4.2 2.4.2
    pip 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 implement input validation and error handling in their TensorFlow applications to handle the CHECK-fail condition gracefully. By checking the input values and ensuring they meet the required criteria before invoking the CTCGreedyDecoder function, the risk of triggering the vulnerability can be mitigated. Here is an example of how to perform input validation in Python:

import tensorflow as tf

inputs = tf.constant([], shape=[18, 2, 0], dtype=tf.float32)
sequence_length = tf.constant([-100, 17], shape=[2], dtype=tf.int32)
merge_repeated = False

if inputs.shape[2] > 0 and all(sequence_length > 0):
    tf.raw_ops.CTCGreedyDecoder(inputs=inputs, sequence_length=sequence_length, merge_repeated=merge_repeated)
else:
    print('Invalid input values')

By explicitly checking the shape of the inputs and the values of the sequence length, the vulnerability can be avoided.

Conclusion

In conclusion, the CVE-2021-29543 vulnerability in TensorFlow can lead to a denial of service attack. Users are advised to update their TensorFlow installations to the patched versions and implement input validation in their applications to mitigate the risk. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for tensorflow →

Share this vulnerability

FAQ

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.

The vulnerability allows an attacker to trigger a denial of service by exploiting a condition check failure in the CTCGreedyDecoder component of TensorFlow. This can lead to the disruption of TensorFlow applications and the unavailability of machine learning services.

To fix this vulnerability, users should update their TensorFlow installations 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. The fix can be obtained by upgrading TensorFlow using the package manager or by manually downloading and installing the latest version from the official TensorFlow website.

Yes, users can implement input validation and error handling in their TensorFlow applications to mitigate the risk of triggering the vulnerability. By checking the input values and ensuring they meet the required criteria before invoking the CTCGreedyDecoder function, the vulnerability can be avoided.

This vulnerability was reported by Yakun Zhang and Ying Wang of Baidu X-Team.

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.1.4 2.1.4
    pip install --upgrade "tensorflow==2.1.4"
  • >= 2.2.0, < 2.2.3 2.2.3
    pip install --upgrade "tensorflow==2.2.3"
  • >= 2.3.0, < 2.3.3 2.3.3
    pip install --upgrade "tensorflow==2.3.3"
  • >= 2.4.0, < 2.4.2 2.4.2
    pip 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 →

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