CVE-2022-35939: TensorFlow: ScatterNd OOB write enables RCE/crash
CRITICALAny TensorFlow deployment accepting user-controlled tensor inputs via the ScatterNd operation is vulnerable to remote code execution or crash — no authentication required, network-reachable. Patch immediately to TF 2.10.0, 2.9.1, 2.8.1, or 2.7.2; if patching is blocked, disable or sandbox any endpoint that processes untrusted ScatterNd inputs. Given CVSS 9.8 with zero prerequisites, treat unpatched internet-facing TF inference services as actively compromised until remediated.
Risk Assessment
Critical risk for organizations exposing TensorFlow inference endpoints over the network, particularly TF Serving or custom APIs that accept arbitrary tensor operations. CVSS 9.8 (AV:N/AC:L/PR:N/UI:N) means exploitation requires no skill, no credentials, and no victim interaction — a malicious client simply sends a crafted tensor with out-of-range indices. TFLite is also affected (the vulnerable code is in reference_ops.h), extending risk to edge inference deployments. No known active exploitation or CISA KEV listing as of assessment, but the trivial attack complexity makes weaponization straightforward.
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, 2.9.1, 2.8.1, or 2.7.2 (commit b4d4b4cb019bd7). Versions before 2.7.2 are EOL and should be migrated.
-
DETECT
Audit all services exposing TensorFlow inference APIs; grep codebases for tf.scatter_nd, tf.tensor_scatter_nd_update, and equivalent TFLite ops.
-
ISOLATE
Place TF inference endpoints behind an API gateway with input schema validation to reject tensor payloads with indices outside expected bounds.
-
MONITOR
Enable crash/OOM alerting on TF Serving processes — repeated crashes may indicate exploitation attempts.
-
INVENTORY
Check all containerized ML workloads for TF version via pip show tensorflow or docker inspect; prioritize internet-facing services.
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-35939?
Any TensorFlow deployment accepting user-controlled tensor inputs via the ScatterNd operation is vulnerable to remote code execution or crash — no authentication required, network-reachable. Patch immediately to TF 2.10.0, 2.9.1, 2.8.1, or 2.7.2; if patching is blocked, disable or sandbox any endpoint that processes untrusted ScatterNd inputs. Given CVSS 9.8 with zero prerequisites, treat unpatched internet-facing TF inference services as actively compromised until remediated.
Is CVE-2022-35939 actively exploited?
No confirmed active exploitation of CVE-2022-35939 has been reported, but organizations should still patch proactively.
How to fix CVE-2022-35939?
1. PATCH: Upgrade to TensorFlow 2.10.0, 2.9.1, 2.8.1, or 2.7.2 (commit b4d4b4cb019bd7). Versions before 2.7.2 are EOL and should be migrated. 2. DETECT: Audit all services exposing TensorFlow inference APIs; grep codebases for tf.scatter_nd, tf.tensor_scatter_nd_update, and equivalent TFLite ops. 3. ISOLATE: Place TF inference endpoints behind an API gateway with input schema validation to reject tensor payloads with indices outside expected bounds. 4. MONITOR: Enable crash/OOM alerting on TF Serving processes — repeated crashes may indicate exploitation attempts. 5. INVENTORY: Check all containerized ML workloads for TF version via pip show tensorflow or docker inspect; prioritize internet-facing services.
What systems are affected by CVE-2022-35939?
This vulnerability affects the following AI/ML architecture patterns: model serving, training pipelines, edge inference (TFLite), ML APIs.
What is the CVSS score for CVE-2022-35939?
CVE-2022-35939 has a CVSS v3.1 base score of 9.8 (CRITICAL). The EPSS exploitation probability is 0.23%.
Technical Details
NVD Description
TensorFlow is an open source platform for machine learning. The `ScatterNd` function takes an input argument that determines the indices of of the output tensor. An input index greater than the output tensor or less than zero will either write content at the wrong index or trigger a crash. We have patched the issue in GitHub commit b4d4b4cb019bd7240a52daa4ba61e3cc814f0384. 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 targeting an organization's AI inference API sends a POST request to the TF Serving prediction endpoint with a crafted SavedModel input containing a ScatterNd operation where the indices tensor includes values exceeding the output tensor's dimensions. With no authentication barrier (or after obtaining a low-privilege API key), the malicious payload triggers an out-of-bounds write in reference_ops.h, potentially redirecting execution flow to attacker-controlled code within the TF Serving process. In a cloud-hosted ML platform scenario, this could allow lateral movement from a compromised inference container to the underlying host or shared infrastructure. Alternatively, a simpler crash-loop attack repeatedly submits malformed tensors to degrade model availability for legitimate users.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H References
- github.com/tensorflow/tensorflow/blob/266558ac4c1f361e9a178ee9d3f0ce2e648ae499/tensorflow/lite/kernels/internal/reference/reference_ops.h 3rd Party
- github.com/tensorflow/tensorflow/commit/b4d4b4cb019bd7240a52daa4ba61e3cc814f0384 Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-ffjm-4qwc-7cmf 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