CVE-2022-29208: TensorFlow - Incomplete Validation in tf.raw_ops.EditDistance

tensorflow Updated 02 Oct 2025

Summary

06/03/2024
Yes i
High
Not published

CVE-2022-29208: Segfault and Out-of-bounds Write write due to incomplete validation in TensorFlow. 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-29208 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 MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

TensorFlow is an 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 domains, including research, industry, and academia. It offers a flexible and efficient framework for building and training machine learning models, enabling developers to leverage the power of deep learning algorithms. However, prior to versions 2.9.0, 2.8.1, 2.7.2, and 2.6.4, TensorFlow is vulnerable to an incomplete validation issue in the implementation of tf.raw_ops.EditDistance.

Vulnerability Detail

The vulnerability arises from incomplete validation in the tf.raw_ops.EditDistance implementation. This allows users to pass negative values, leading to a segmentation fault-based denial of service. The issue stems from the lack of proper bounds checking for array write operations. While the existing validation checks against the upper bound of the array, it fails to prevent writing before the array. By manipulating the input to generate negative values for loc, an attacker can exploit this vulnerability. Versions 2.9.0, 2.8.1, 2.7.2, and 2.6.4 have been patched to address this issue.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 2.6.4 2.6.4
  • >= 2.7.0, < 2.7.2 2.7.2
  • >= 2.8.0, < 2.8.1 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 workaround, users can apply input validation checks in their own code to prevent negative values from being passed to tf.raw_ops.EditDistance. By validating the input and ensuring that only valid values are used, the vulnerability can be mitigated. Here is an example of how to perform input validation in Python:

loc = ...  # User-provided input

if loc < 0:
    raise ValueError('Invalid input: loc must be a non-negative value')

# Continue with the rest of the code

Conclusion

The incomplete validation vulnerability in TensorFlow's tf.raw_ops.EditDistance has the potential to cause a denial of service. It is crucial to update TensorFlow to the patched versions (2.9.0, 2.8.1, 2.7.2, or 2.6.4) to mitigate this issue. Additionally, applying input validation checks in user code can serve as a temporary workaround. For further support on vulnerability remediation, contact DevNack.com.

See every vulnerability recorded for tensorflow →

Share this vulnerability

FAQ

TensorFlow is an open source platform for machine learning that provides a comprehensive ecosystem of tools, libraries, and resources for developing and deploying machine learning models.

The vulnerability allows an attacker to cause a denial of service by passing negative values to tf.raw_ops.EditDistance, resulting in a segmentation fault. This can disrupt the normal operation of TensorFlow and potentially impact the availability of machine learning applications relying on TensorFlow.

Versions prior to 2.9.0, 2.8.1, 2.7.2, and 2.6.4 are affected by this vulnerability. It is recommended to update to one of the patched versions to mitigate the issue.

To fix this vulnerability, update TensorFlow to versions 2.9.0, 2.8.1, 2.7.2, or 2.6.4, which contain the necessary patches. Follow the official upgrade instructions provided by the TensorFlow team.

Yes, users can apply input validation checks in their own code to prevent negative values from being passed to tf.raw_ops.EditDistance. By validating the input and ensuring that only valid values are used, the vulnerability can be mitigated.

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 2.6.4 2.6.4
  • >= 2.7.0, < 2.7.2 2.7.2
  • >= 2.8.0, < 2.8.1 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