CVE-2022-35939: TensorFlow: ScatterNd OOB write enables RCE/crash

CRITICAL
Published September 16, 2022
CISO Take

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.

What is the risk?

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.

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.8 / 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 High
A High

What should I do?

5 steps
  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 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
ISO 42001
A.6.2.6 - AI system security
NIST AI RMF
MANAGE 2.2 - Mechanisms to sustain the value of deployed AI systems are evaluated and applied MAP 5.1 - Likelihood and magnitude of each identified impact based on impacts to individuals, groups, communities, organizations, and society

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

What is the AI security impact?

Affected AI Architectures

model servingtraining pipelinesedge inference (TFLite)ML APIs

MITRE ATLAS Techniques

AML.T0010.001 AI Software
AML.T0029 Denial of AI Service
AML.T0043 Craft Adversarial Data
AML.T0049 Exploit Public-Facing Application

Compliance Controls Affected

EU AI Act: Article 15
ISO 42001: A.6.2.6
NIST AI RMF: MANAGE 2.2, MAP 5.1

What are the technical details?

Original Advisory

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)

CWE-787 — Out-of-bounds Write: The product writes data past the end, or before the beginning, of the intended buffer.

  • [Requirements] Use a language that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. For example, many languages that perform their own memory management, such as Java and Perl, are not subject to buffer overflows. Other languages, such as Ada and C#, typically provide overflow protection, but the protection can be disabled by the programmer. Be wary that a language's interface to native code may still be subject to overflows, even if the language itself is theoretically safe.
  • [Architecture and Design] Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. Examples include the Safe C String Library (SafeStr) by Messier and Viega [REF-57], and the Strsafe.h library from Microsoft [REF-56]. These libraries provide safer versions of overflow-prone string-handling functions.

Source: MITRE CWE corpus.

CVSS Vector

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

Timeline

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

Related Vulnerabilities