CVE-2022-21730: TensorFlow: OOB read leaks heap memory, enables DoS

HIGH PoC AVAILABLE CISA: TRACK*
Published February 3, 2022
CISO Take

TensorFlow versions before 2.8.0 allow a low-privileged remote attacker to trigger an out-of-bounds heap read via malformed tensor inputs to FractionalAvgPoolGrad, leaking memory contents or crashing the process. Upgrade to TensorFlow 2.8.0 immediately; backport patches are available for 2.7.1, 2.6.3, and 2.5.3. Any deployment exposing TensorFlow training or inference endpoints to untrusted input is directly at risk.

Risk Assessment

High risk (CVSS 8.1) due to network exploitability with low complexity and no user interaction required. The exploit path and fix commit are publicly documented, making exploitation straightforward for any attacker familiar with TensorFlow's tensor API. Not in CISA KEV and published in 2022, but unpatched deployments remain fully exposed. Organizations running model inference APIs or multi-tenant training platforms accepting external input without strict shape validation face immediate confidentiality and availability impact.

Affected Systems

Package Ecosystem Vulnerable Range Patched
tensorflow pip No patch
195.0K OpenSSF 7.2 3.7K dependents Pushed today 4% patched ~1372d to patch Full package profile →

Do you use tensorflow? You're affected.

Severity & Risk

CVSS 3.1
8.1 / 10
EPSS
0.3%
chance of exploitation in 30 days
Higher than 55% of all CVEs
Exploitation Status
Exploit Available
Exploitation: MEDIUM
Sophistication
Moderate
Exploitation Confidence
medium
CISA SSVC: Public PoC
Public PoC indexed (trickest/cve)
Composite signal derived from CISA KEV, CISA SSVC, EPSS, trickest/cve, and Nuclei templates.

Attack Surface

AV AC PR UI S C I A
AV Network
AC Low
PR Low
UI None
S Unchanged
C High
I None
A High

Recommended Action

5 steps
  1. Patch: Upgrade to TensorFlow 2.8.0 or apply the backport commit (002408c3696b) to 2.7.1, 2.6.3, or 2.5.3.

  2. Input validation: Enforce strict tensor shape and dtype validation at all API boundaries before passing inputs to TF ops.

  3. Sandboxing: Run TensorFlow serving processes in isolated containers or VMs to limit blast radius of any memory disclosure.

  4. Least privilege: Restrict which users or services can invoke custom or pooling-related ops on shared infrastructure.

  5. Detection: Alert on abnormal OOM errors, segfaults, or crash loops in TF serving logs, which may indicate active exploitation attempts.

CISA SSVC Assessment

Decision Track*
Exploitation poc
Automatable No
Technical Impact partial

Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.

Classification

Compliance Impact

This CVE is relevant to:

EU AI Act
Article 15 - Accuracy, robustness and cybersecurity
ISO 42001
A.10.1 - Information security in AI systems
NIST AI RMF
MANAGE-2.2 - Risk Treatment and Incident Response
OWASP LLM Top 10
LLM05 - Supply Chain Vulnerabilities

Frequently Asked Questions

What is CVE-2022-21730?

TensorFlow versions before 2.8.0 allow a low-privileged remote attacker to trigger an out-of-bounds heap read via malformed tensor inputs to FractionalAvgPoolGrad, leaking memory contents or crashing the process. Upgrade to TensorFlow 2.8.0 immediately; backport patches are available for 2.7.1, 2.6.3, and 2.5.3. Any deployment exposing TensorFlow training or inference endpoints to untrusted input is directly at risk.

Is CVE-2022-21730 actively exploited?

Proof-of-concept exploit code is publicly available for CVE-2022-21730, increasing the risk of exploitation.

How to fix CVE-2022-21730?

1. Patch: Upgrade to TensorFlow 2.8.0 or apply the backport commit (002408c3696b) to 2.7.1, 2.6.3, or 2.5.3. 2. Input validation: Enforce strict tensor shape and dtype validation at all API boundaries before passing inputs to TF ops. 3. Sandboxing: Run TensorFlow serving processes in isolated containers or VMs to limit blast radius of any memory disclosure. 4. Least privilege: Restrict which users or services can invoke custom or pooling-related ops on shared infrastructure. 5. Detection: Alert on abnormal OOM errors, segfaults, or crash loops in TF serving logs, which may indicate active exploitation attempts.

What systems are affected by CVE-2022-21730?

This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, MLOps platforms, inference endpoints, multi-tenant Jupyter environments.

What is the CVSS score for CVE-2022-21730?

CVE-2022-21730 has a CVSS v3.1 base score of 8.1 (HIGH). The EPSS exploitation probability is 0.32%.

Technical Details

NVD Description

Tensorflow is an Open Source Machine Learning Framework. The implementation of `FractionalAvgPoolGrad` does not consider cases where the input tensors are invalid allowing an attacker to read from outside of bounds of heap. The fix will be included in TensorFlow 2.8.0. We will also cherrypick this commit on TensorFlow 2.7.1, TensorFlow 2.6.3, and TensorFlow 2.5.3, as these are also affected and still in supported range.

Exploitation Scenario

An adversary with low-privilege API access to a TensorFlow-based inference service targeting a CNN model with fractional pooling layers crafts a request containing deliberately invalid tensor dimensions for the FractionalAvgPoolGrad op. The malformed tensor triggers the out-of-bounds read in the C++ kernel—no Python exception is raised. Depending on heap layout at the time of exploitation, the attacker may read adjacent memory containing model weights, cached training batch data, or credentials stored in the process heap. Alternatively, the attacker repeatedly sends malformed tensors to crash the serving process, causing sustained denial of service against production ML endpoints.

CVSS Vector

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H

Timeline

Published
February 3, 2022
Last Modified
May 5, 2025
First Seen
February 3, 2022

Related Vulnerabilities