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.

What is the risk?

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.

What systems are affected?

Package Ecosystem Vulnerable Range Patched
TensorFlow pip No patch
195.8K OpenSSF 7.1 3.7K dependents Pushed 3d ago 4% patched ~1372d to patch Full package profile →

Do you use TensorFlow? You're affected.

How severe is it?

CVSS 3.1
8.1 / 10
EPSS
0.8%
chance of exploitation in 30 days
Higher than 52% 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, VulnCheck KEV, CISA SSVC, EPSS, Metasploit, Exploit-DB, trickest/cve, Nuclei templates, and inthewild.io exploitation reports.

What is the 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

What should I do?

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.

What does CISA's SSVC say?

Decision Track*
Exploitation poc
Automatable No
Technical Impact partial

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

How is it classified?

Which compliance frameworks are affected?

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.80%.

What is the AI security impact?

Affected AI Architectures

training pipelinesmodel servingMLOps platformsinference endpointsmulti-tenant Jupyter environments

MITRE ATLAS Techniques

AML.T0010.001 AI Software
AML.T0025 Exfiltration via Cyber Means
AML.T0029 Denial of AI Service
AML.T0049 Exploit Public-Facing Application

Compliance Controls Affected

EU AI Act: Article 15
ISO 42001: A.10.1
NIST AI RMF: MANAGE-2.2
OWASP LLM Top 10: LLM05

What are the technical details?

Original Advisory

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.

Weaknesses (CWE)

CWE-125 — Out-of-bounds Read: The product reads data past the end, or before the beginning, of the intended buffer.

  • [Implementation] Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylis
  • [Architecture and Design] Use a language that provides appropriate memory abstractions.

Source: MITRE CWE corpus.

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