CVE-2022-23574: TensorFlow - Heap Out-of-Bounds Read/Write

tensorflow Updated 02 Oct 2025

Summary

06/03/2024
Yes i
High
Not published

CVE-2022-23574: Out of bounds read and write in Tensorflow. Affects tensorflow across 3 version ranges.

< 2.5.3 >= 2.6.0, < 2.6.3 >= 2.7.0, < 2.7.1

Fixed in 2.5.3, 2.6.3 or 2.7.1, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2022-23574 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 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 could lead to heap out-of-bounds read/write attacks.

Vulnerability Detail

The vulnerability in TensorFlow is caused by a typo in the SpecializeType function, which results in a heap out-of-bounds read/write. The arg variable is incorrectly initialized to the ith mutable argument in a loop where the loop index is j. This allows an attacker to assign values to arg from outside the vector of arguments, leading to both read and write operations outside the bounds of the data. This can potentially be exploited to execute arbitrary code or disclose sensitive information. The vulnerability affects versions 2.7.0 and earlier, including 2.6.3 and 2.7.1, but has been fixed in TensorFlow 2.8.0.

How To Fix

Fixed versions by release line

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

  • < 2.5.3 2.5.3
  • >= 2.6.0, < 2.6.3 2.6.3
  • >= 2.7.0, < 2.7.1 2.7.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 apply the following code snippet to mitigate the vulnerability:

import tensorflow as tf

def patched_SpecializeType(*args, **kwargs):
    # Apply custom patch here
    ...
    return tf.raw_ops.SpecializeType(*args, **kwargs)

# Monkey-patch the vulnerable function
if tf.__version__ <= '2.7.1':
    tf.raw_ops.SpecializeType = patched_SpecializeType

Conclusion

The vulnerability in TensorFlow can pose a significant security risk, allowing attackers to execute arbitrary code or access sensitive information. It is crucial to update to TensorFlow 2.8.0 or later to mitigate this vulnerability. Regularly updating all dependencies and libraries is also recommended to ensure the latest security patches are applied. 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 in TensorFlow can potentially allow an attacker to execute arbitrary code or disclose sensitive information by exploiting the heap out-of-bounds read/write issue.

The vulnerability affects TensorFlow versions 2.7.0 and earlier, including 2.6.3 and 2.7.1.

Yes, the vulnerability has been fixed in TensorFlow 2.8.0. It is recommended to update to this version or later to mitigate the risk.

Yes, a temporary workaround is to apply a custom patch to the SpecializeType function. The provided code snippet demonstrates how to monkey-patch the vulnerable function.

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.5.3 2.5.3
  • >= 2.6.0, < 2.6.3 2.6.3
  • >= 2.7.0, < 2.7.1 2.7.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