CVE-2022-29202: Denial of Service in TensorFlow due to Lack of Validation

tensorflow Updated 02 Oct 2025

Summary

24/05/2022
Yes i
Moderate
5.5

CVE-2022-29202: Denial of service in tf.ragged.constant due to lack of validation. Affects tensorflow across 3 version ranges.

< 2.6.4 >= 2.7.0, < 2.7.2 >= 2.8.0, < 2.8.1

Fixed in 2.6.4, 2.7.2 or 2.8.1, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2022-29202 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 Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

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 identified in TensorFlow that can lead to a denial of service (DoS) attack.

Vulnerability Detail

The vulnerability, identified as CVE-2022-29202, exists in the tf.ragged.constant function of TensorFlow. This function is responsible for creating ragged tensors, which are multi-dimensional arrays with varying lengths along each dimension. The implementation of tf.ragged.constant does not properly validate the input arguments, allowing an attacker to trigger a DoS attack by providing malicious input that consumes all available memory. By exploiting this vulnerability, an attacker can cause the TensorFlow application to crash or become unresponsive, disrupting its normal operation.

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.6.4 2.6.4
    pip install --upgrade "tensorflow==2.6.4"
  • >= 2.7.0, < 2.7.2 2.7.2
    pip install --upgrade "tensorflow==2.7.2"
  • >= 2.8.0, < 2.8.1 2.8.1
    pip install --upgrade "tensorflow==2.8.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 temporary workaround, users can avoid using the tf.ragged.constant function with untrusted input. If the function is necessary for the application, it is recommended to implement input validation and sanitization to prevent malicious input from triggering the vulnerability. Here is an example of input validation for tf.ragged.constant:

import tensorflow as tf

def validate_input(pylist, ragged_rank):
    if not isinstance(pylist, list):
        raise ValueError('pylist must be a list')
    if not isinstance(ragged_rank, int):
        raise ValueError('ragged_rank must be an integer')
    # Additional validation logic
    ...
    # Call tf.ragged.constant with validated input
    tf.ragged.constant(pylist=pylist, ragged_rank=ragged_rank)

validate_input([], 0)

By implementing input validation, the application can mitigate the risk of the DoS vulnerability.

Conclusion

The vulnerability in TensorFlow's tf.ragged.constant function can lead to a denial of service (DoS) attack. To mitigate this risk, it is crucial to update TensorFlow to one of the patched versions and implement input validation for the affected function. For further assistance and support in 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 tools and resources for building and deploying machine learning models.

The vulnerability allows an attacker to trigger a denial of service (DoS) attack by consuming all available memory, causing the TensorFlow application to crash or become unresponsive.

To fix the vulnerability, update your TensorFlow installation to one of the patched versions: TensorFlow 2.6.4, TensorFlow 2.7.2, TensorFlow 2.8.1, or TensorFlow 2.9.0 (upcoming release).

As a temporary workaround, avoid using the tf.ragged.constant function with untrusted input. Implement input validation and sanitization to prevent malicious input from triggering the vulnerability.

You can validate the input for tf.ragged.constant by checking the types of the input arguments and implementing additional validation logic as needed. See the provided code example for reference.

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.6.4 2.6.4
    pip install --upgrade "tensorflow==2.6.4"
  • >= 2.7.0, < 2.7.2 2.7.2
    pip install --upgrade "tensorflow==2.7.2"
  • >= 2.8.0, < 2.8.1 2.8.1
    pip install --upgrade "tensorflow==2.8.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