CVE-2022-21728: TensorFlow: heap OOB read in ReverseSequence op

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

Upgrade TensorFlow to 2.8.0, 2.7.1, 2.6.3, or 2.5.3 immediately. A low-privileged authenticated attacker can send a crafted request to any TF inference endpoint, triggering a heap out-of-bounds read in ReverseSequence shape inference—resulting in memory disclosure or service crash. Multi-tenant ML platforms where users share a TF runtime are at highest risk and should prioritize patching or workload isolation.

What is the risk?

High risk for organizations exposing TensorFlow-based inference APIs to authenticated but partially-trusted users. CVSS 8.1 with network attack vector and low privilege requirement means any authenticated tenant on a shared ML platform can trigger this. Low attack complexity makes opportunistic exploitation realistic once an attacker knows the vector. No CISA KEV entry and no public exploit PoC reduces immediate urgency, but the CVSS profile warrants patching within your standard high-severity SLA.

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
1.1%
chance of exploitation in 30 days
Higher than 62% 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 cherrypick backports to 2.7.1, 2.6.3, 2.5.3).

  2. DETECT

    Audit logs for shape inference exceptions or unexpected TF worker crashes—these may indicate exploit attempts.

  3. WORKAROUND (if patching delayed): Add server-side input validation to reject negative batch_dim values before passing user-controlled tensors to TF ops.

  4. ISOLATE

    Run TF inference workers in per-tenant containers to limit blast radius of any memory disclosure.

  5. INVENTORY

    Identify all internal services consuming TensorFlow as a dependency, including ML pipelines, notebooks, and model servers.

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.5.2 - AI Risk Treatment
NIST AI RMF
MANAGE-2.2 - AI Risk Response
OWASP LLM Top 10
LLM03 - Supply Chain Vulnerabilities

Frequently Asked Questions

What is CVE-2022-21728?

Upgrade TensorFlow to 2.8.0, 2.7.1, 2.6.3, or 2.5.3 immediately. A low-privileged authenticated attacker can send a crafted request to any TF inference endpoint, triggering a heap out-of-bounds read in ReverseSequence shape inference—resulting in memory disclosure or service crash. Multi-tenant ML platforms where users share a TF runtime are at highest risk and should prioritize patching or workload isolation.

Is CVE-2022-21728 actively exploited?

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

How to fix CVE-2022-21728?

1. PATCH: Upgrade to TensorFlow 2.8.0 (or cherrypick backports to 2.7.1, 2.6.3, 2.5.3). 2. DETECT: Audit logs for shape inference exceptions or unexpected TF worker crashes—these may indicate exploit attempts. 3. WORKAROUND (if patching delayed): Add server-side input validation to reject negative batch_dim values before passing user-controlled tensors to TF ops. 4. ISOLATE: Run TF inference workers in per-tenant containers to limit blast radius of any memory disclosure. 5. INVENTORY: Identify all internal services consuming TensorFlow as a dependency, including ML pipelines, notebooks, and model servers.

What systems are affected by CVE-2022-21728?

This vulnerability affects the following AI/ML architecture patterns: model serving, training pipelines, inference endpoints, shared ML platforms.

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

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

What is the AI security impact?

Affected AI Architectures

model servingtraining pipelinesinference endpointsshared ML platforms

MITRE ATLAS Techniques

AML.T0010.001 AI Software
AML.T0029 Denial of AI Service
AML.T0049 Exploit Public-Facing Application

Compliance Controls Affected

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

What are the technical details?

Original Advisory

Tensorflow is an Open Source Machine Learning Framework. The implementation of shape inference for `ReverseSequence` does not fully validate the value of `batch_dim` and can result in a heap OOB read. There is a check to make sure the value of `batch_dim` does not go over the rank of the input, but there is no check for negative values. Negative dimensions are allowed in some cases to mimic Python's negative indexing (i.e., indexing from the end of the array), however if the value is too negative then the implementation of `Dim` would access elements before the start of an array. 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 attacker with authenticated access to a model serving endpoint (e.g., TF Serving, a custom FastAPI inference wrapper, or a shared Jupyter environment) submits an inference request containing a ReverseSequence op where batch_dim is set to a large negative integer (e.g., -999). TensorFlow's shape inference calls Dim() without validating the negative value, causing a read at a memory address before the array's start. Depending on memory layout, the service either returns an error response leaking partial heap contents (process memory, potentially including API keys or tensor data from other tenants) or crashes the inference worker entirely. In a SageMaker or Vertex AI multi-model server, this could allow one model's endpoint to crash shared infrastructure or leak data across tenants.

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