CVE-2022-35938: TensorFlow: OOB read in GatherNd causes crash/data leak
CRITICALAny 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 |
Do you use tensorflow? You're affected.
Severity & Risk
Attack Surface
Recommended Action
5 steps-
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.
-
SCOPE
Audit all services using tf.gather_nd() or models with embedding lookup layers exposed to external inputs.
-
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.
-
DETECT
Monitor for anomalous crash/restart cycles in TF Serving containers — repeated crashes on specific inputs may indicate active probing.
-
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
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
Classification
Compliance Impact
This CVE is relevant to:
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 References
- github.com/tensorflow/tensorflow/security/advisories/GHSA-3m3g-pf5v-5hpj Patch 3rd Party
- github.com/tensorflow/tflite-micro/blob/1bc98621180a350eb4e8d3318ea8e228c7559b37/tensorflow/lite/micro/kernels/gather_nd.cc 3rd Party
- github.com/tensorflow/tflite-micro/commit/4142e47e9e31db481781b955ed3ff807a781b494 Patch 3rd Party
Timeline
Related Vulnerabilities
CVE-2020-15196 9.9 TensorFlow: heap OOB read in sparse/ragged count ops
Same package: tensorflow CVE-2020-15205 9.8 TensorFlow: heap overflow in StringNGrams, ASLR bypass
Same package: tensorflow CVE-2020-15208 9.8 TFLite: OOB read/write via tensor dimension mismatch
Same package: tensorflow CVE-2019-16778 9.8 TensorFlow: heap overflow in UnsortedSegmentSum op
Same package: tensorflow CVE-2022-23587 9.8 TensorFlow: integer overflow in Grappler enables RCE
Same package: tensorflow
AI Threat Alert