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.
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 |
Do you use TensorFlow? You're affected.
How severe is it?
What is the attack surface?
What should I do?
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.
What does CISA's SSVC say?
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:
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
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
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 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