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.

Risk Assessment

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.

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
1.1%
chance of exploitation in 30 days
Higher than 78% 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 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.

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

Technical Details

NVD Description

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.

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