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.

What is the risk?

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.

What systems are affected?

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

Do you use TensorFlow? You're affected.

How severe is it?

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

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

What should I do?

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.

What does CISA's SSVC say?

Decision Track
Exploitation none
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 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.43%.

What is the AI security impact?

Affected AI Architectures

model servingtraining pipelinesinferenceembedding-based recommendation systemsedge/IoT ML (TFLite Micro)

MITRE ATLAS Techniques

AML.T0010.001 AI Software
AML.T0029 Denial of AI Service
AML.T0040 AI Model Inference API Access
AML.T0049 Exploit Public-Facing Application

Compliance Controls Affected

EU AI Act: Article 15
ISO 42001: 8.4
NIST AI RMF: MS-2.5
OWASP LLM Top 10: LLM03:2025

What are the technical details?

Original Advisory

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)

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: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