CVE-2022-35938: TensorFlow: OOB read in GatherNd causes crash/data leak

CRITICAL
Published September 16, 2022
CISO Take

Any TensorFlow deployment using GatherNd operations (embedding lookups, attention mechanisms, sparse ops) exposed to untrusted input is vulnerable to remote crash or memory disclosure with no authentication required. Patch immediately to TF 2.10.0 / 2.9.1 / 2.8.1 / 2.7.2 — there are no workarounds. Prioritize model-serving endpoints (TensorFlow Serving, TFX) reachable from the internet or untrusted networks.

Risk Assessment

Critical risk for organizations running TensorFlow inference APIs. CVSS 9.1 with network vector, zero authentication, and low complexity means exploitation is straightforward for any attacker who can reach the endpoint. The OOB read (CWE-125) yields both availability impact (crash/DoS) and confidentiality impact (process memory disclosure), which in an ML context could leak model weights, API secrets, or training data fragments from process memory. No active KEV listing suggests no confirmed mass exploitation, but the attack surface is large given TensorFlow's prevalence.

Affected Systems

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

Do you use tensorflow? You're affected.

Severity & Risk

CVSS 3.1
9.1 / 10
EPSS
0.1%
chance of exploitation in 30 days
Higher than 31% of all CVEs
Exploitation Status
No known exploitation
Sophistication
Trivial

Attack Surface

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

Recommended Action

5 steps
  1. PATCH

    Upgrade to TensorFlow 2.10.0, or backport patches to 2.9.1, 2.8.1, or 2.7.2. Commit 4142e47e9e31db481781b955ed3ff807a781b494 contains the fix.

  2. SCOPE

    Audit all services using tf.gather_nd() or models with embedding lookup layers exposed to external inputs.

  3. NETWORK

    Place TensorFlow Serving behind an API gateway with input validation and rate limiting. Reject tensors with indices outside expected bounds at the gateway layer.

  4. DETECT

    Monitor for anomalous crash/restart cycles in TF Serving containers — repeated crashes on specific inputs may indicate active probing.

  5. TFLITE-MICRO: Patch tflite-micro separately if deployed on edge devices; it has its own affected kernel at gather_nd.cc:143-154.

CISA SSVC Assessment

Decision Track
Exploitation none
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 for high-risk AI
ISO 42001
8.4 - AI system security and resilience
NIST AI RMF
MS-2.5 - Robustness and adversarial testing
OWASP LLM Top 10
LLM03:2025 - Supply Chain

Frequently Asked Questions

What is CVE-2022-35938?

Any TensorFlow deployment using GatherNd operations (embedding lookups, attention mechanisms, sparse ops) exposed to untrusted input is vulnerable to remote crash or memory disclosure with no authentication required. Patch immediately to TF 2.10.0 / 2.9.1 / 2.8.1 / 2.7.2 — there are no workarounds. Prioritize model-serving endpoints (TensorFlow Serving, TFX) reachable from the internet or untrusted networks.

Is CVE-2022-35938 actively exploited?

No confirmed active exploitation of CVE-2022-35938 has been reported, but organizations should still patch proactively.

How to fix CVE-2022-35938?

1. PATCH: Upgrade to TensorFlow 2.10.0, or backport patches to 2.9.1, 2.8.1, or 2.7.2. Commit 4142e47e9e31db481781b955ed3ff807a781b494 contains the fix. 2. SCOPE: Audit all services using tf.gather_nd() or models with embedding lookup layers exposed to external inputs. 3. NETWORK: Place TensorFlow Serving behind an API gateway with input validation and rate limiting. Reject tensors with indices outside expected bounds at the gateway layer. 4. DETECT: Monitor for anomalous crash/restart cycles in TF Serving containers — repeated crashes on specific inputs may indicate active probing. 5. TFLITE-MICRO: Patch tflite-micro separately if deployed on edge devices; it has its own affected kernel at gather_nd.cc:143-154.

What systems are affected by CVE-2022-35938?

This vulnerability affects the following AI/ML architecture patterns: model serving, training pipelines, inference, embedding-based recommendation systems, edge/IoT ML (TFLite Micro).

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

CVE-2022-35938 has a CVSS v3.1 base score of 9.1 (CRITICAL). The EPSS exploitation probability is 0.13%.

Technical Details

NVD Description

TensorFlow is an open source platform for machine learning. The `GatherNd` function takes arguments that determine the sizes of inputs and outputs. If the inputs given are greater than or equal to the sizes of the outputs, an out-of-bounds memory read or a crash is triggered. This issue has been patched in GitHub commit 4142e47e9e31db481781b955ed3ff807a781b494. The fix will be included in TensorFlow 2.10.0. We will also cherrypick this commit on TensorFlow 2.9.1, TensorFlow 2.8.1, and TensorFlow 2.7.2, as these are also affected and still in supported range. There are no known workarounds for this issue.

Exploitation Scenario

An adversary targets a public recommendation or NLP inference API backed by TensorFlow Serving. The model uses an embedding lookup layer (internally GatherNd). The adversary submits a crafted inference request containing index values equal to or exceeding the output tensor size. This triggers the OOB memory read: in the best case the service crashes (DoS, disrupting the AI pipeline); in the worst case the read returns adjacent process memory contents in the response or error trace, potentially leaking model weights, environment variables with API keys, or fragments of other users' inference data. With low complexity and no auth required, a script-kiddie can automate this via repeated requests to map exploitable endpoints.

Weaknesses (CWE)

CVSS Vector

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

Timeline

Published
September 16, 2022
Last Modified
November 21, 2024
First Seen
September 16, 2022

Related Vulnerabilities