CVE-2022-23580: TensorFlow CPU - Shape Inference Large Vector Allocation Vulnerability

tensorflow-cpu Updated 02 Oct 2025

Summary

04/02/2022
Yes i
Unrated
Not published

CVE-2022-23580: Tensorflow is an Open Source Machine Learning Framework. Affects tensorflow-cpu across 3 version ranges.

< 2.5.3 >= 2.6.0, < 2.6.3 < 1361fb7e29449629e1df94d44e0427ebec8c83c7

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

Also tracked for

The same CVE-2022-23580 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 widely used for developing and training machine learning models. It provides a comprehensive ecosystem for building and deploying machine learning applications. TensorFlow CPU is a specific package within TensorFlow that focuses on running TensorFlow on CPUs. It is commonly used in environments where GPU acceleration is not available or required. TensorFlow CPU allows users to leverage the power of TensorFlow on CPU-based systems.

Vulnerability Detail

The vulnerability identified as CVE-2022-23580 affects TensorFlow CPU. During shape inference, TensorFlow CPU can allocate a large vector based on a value from a tensor controlled by the user. This can lead to a potential memory allocation issue, causing the system to run out of memory or crash. An attacker could exploit this vulnerability by providing a specially crafted input tensor, leading to a denial of service (DoS) attack or potential remote code execution.

How To Fix

Latest published version: 2.21.0 as of 22 Oct 2026

pip install --upgrade "tensorflow-cpu==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.5.3 2.5.3
    pip install --upgrade "tensorflow-cpu==2.5.3"
  • >= 2.6.0, < 2.6.3 2.6.3
    pip install --upgrade "tensorflow-cpu==2.6.3"

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 sanitization to ensure that the tensors provided to TensorFlow CPU do not contain malicious or excessively large values. By carefully validating user input, the risk of triggering the vulnerability can be reduced. Here is an example of input validation code:

import tensorflow as tf

def validate_input(tensor):
    if tensor.shape[0] > MAX_SIZE:
        raise ValueError('Input tensor size exceeds maximum allowed size.')
    # Additional validation logic
    ...

# Usage
input_tensor = ...
validate_input(input_tensor)
model = tf.keras.models.load_model('model.h5')
model.predict(input_tensor)

Conclusion

In conclusion, the TensorFlow CPU Shape Inference Large Vector Allocation Vulnerability (CVE-2022-23580) poses a risk of memory allocation issues and potential DoS attacks or remote code execution. It is crucial to update to the latest version of TensorFlow CPU or apply the provided patches to mitigate this vulnerability. Implementing input validation and sanitization can also help reduce the risk. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for tensorflow-cpu →

Share this vulnerability

FAQ

TensorFlow CPU is a package within the TensorFlow framework that allows users to run TensorFlow on CPU-based systems. It is commonly used in environments where GPU acceleration is not available or required.

Shape inference in TensorFlow is the process of determining the shape of tensors (multi-dimensional arrays) at runtime. It helps in automatically inferring the shape of tensors based on the operations performed on them.

This vulnerability can lead to a denial of service (DoS) attack or potential remote code execution. An attacker could exploit the vulnerability by providing a specially crafted input tensor, causing the system to run out of memory or crash.

You can use Vulert's playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability. Vulert monitors and alerts in real-time for open-source vulnerabilities, using just the Pipfile.lock file.

You can find more information about this vulnerability in the official TensorFlow advisory database. The source for this vulnerability is available on GitHub: https://github.com/pypa/advisory-database/blob/main/vulns/tensorflow-cpu/PYSEC-2022-89.yaml

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow-cpu.

How To Fix

Latest published version: 2.21.0 as of 22 Oct 2026

pip install --upgrade "tensorflow-cpu==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.5.3 2.5.3
    pip install --upgrade "tensorflow-cpu==2.5.3"
  • >= 2.6.0, < 2.6.3 2.6.3
    pip install --upgrade "tensorflow-cpu==2.6.3"

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