CVE-2022-23575: TensorFlow - Integer Overflow in OpLevelCostEstimator::CalculateTensorSize

tensorflow Updated 02 Oct 2025

Summary

06/03/2024
Yes i
Medium
Not published

CVE-2022-23575: Integer overflow 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-23575 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 Your last release was probably never penetration tested 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. This vulnerability affects the implementation of OpLevelCostEstimator::CalculateTensorSize in TensorFlow. The vulnerability arises when an operation involving a tensor with a large number of elements is created, leading to an integer overflow. This vulnerability can be exploited by an attacker to cause a denial-of-service (DoS) condition or potentially execute arbitrary code.

Vulnerability Detail

The vulnerability in TensorFlow's OpLevelCostEstimator::CalculateTensorSize stems from an integer overflow that occurs when an operation involving a tensor with a large number of elements is created. This integer overflow can lead to unexpected behavior, such as memory corruption or crashes, which can be exploited by an attacker. The impact of this vulnerability can range from a DoS condition, where the TensorFlow application becomes unresponsive, to potential code execution, depending on how the attacker leverages the vulnerability. The fix for this vulnerability will be included in TensorFlow 2.8.0, and patches will also be provided for TensorFlow 2.7.1, TensorFlow 2.6.3, and TensorFlow 2.5.3, as these versions are still within the supported range.

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 consider implementing input validation checks to ensure that operations involving tensors do not exceed a certain size limit. By enforcing size limits on tensors, the risk of triggering the integer overflow can be mitigated. Here is an example of how input validation can be implemented in Python:

import tensorflow as tf

def safe_tensor_operation(tensor):
    max_size = 1000000  # Set a maximum size limit
    if tf.size(tensor) > max_size:
        raise ValueError('Tensor size exceeds the maximum limit')
    # Perform the desired tensor operation
    ...

Conclusion

The vulnerability in TensorFlow's OpLevelCostEstimator::CalculateTensorSize can lead to a denial-of-service condition or potential code execution. It is crucial to update TensorFlow to the latest version once the fix is released. In the meantime, implementing input validation checks can serve as a temporary workaround. Regularly updating software and following secure coding practices are essential to mitigate the risk of similar vulnerabilities. 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.

This vulnerability can lead to a denial-of-service (DoS) condition or potentially allow an attacker to execute arbitrary code. The severity of the impact depends on how the vulnerability is exploited.

The vulnerability affects TensorFlow versions 2.5.2, 2.6.0, 2.6.1, 2.6.2, and 2.7.0. TensorFlow 2.8.0 will include the fix for this vulnerability.

To fix this vulnerability, it is recommended to update TensorFlow to version 2.8.0 once it is released. Patches will also be provided for TensorFlow 2.7.1, TensorFlow 2.6.3, and TensorFlow 2.5.3.

As a temporary workaround, users can implement input validation checks to ensure that operations involving tensors do not exceed a certain size limit. By enforcing size limits, the risk of triggering the integer overflow 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.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