CVE-2022-35987: TensorFlow: DoS via DenseBincount shape mismatch

HIGH PoC AVAILABLE
Published September 16, 2022
CISO Take

Any unauthenticated attacker can crash TensorFlow inference processes by sending a malformed weights tensor to any endpoint that invokes DenseBincount — no ML knowledge required. Patch to TF 2.10.0, 2.9.1, 2.8.1, or 2.7.2 immediately; no workaround exists. Prioritize externally exposed TF Serving deployments and any model API that accepts user-controlled tensor inputs.

What is the risk?

High operational risk for organizations exposing TensorFlow-backed inference APIs. CVSS 7.5 — network-accessible, zero authentication, low complexity. Impact is limited to availability (no code execution, no data exfiltration), but a single malformed request crashes the serving process. In production AI pipelines without automatic restart, this translates to full service outage. Recommender systems and categorical preprocessing pipelines are most exposed due to typical DenseBincount usage patterns.

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
7.5 / 10
EPSS
0.4%
chance of exploitation in 30 days
Higher than 30% of all CVEs
Exploitation Status
Exploit Available
Exploitation: MEDIUM
Sophistication
Trivial
Exploitation Confidence
medium
Public PoC indexed (trickest/cve)
Composite signal derived from CISA KEV, VulnCheck KEV, CISA SSVC, EPSS, Metasploit, Exploit-DB, trickest/cve, Nuclei templates, and inthewild.io exploitation reports.

What is the attack surface?

AV AC PR UI S C I A
AV Network
AC Low
PR None
UI None
S Unchanged
C None
I None
A High

What should I do?

5 steps
  1. Patch to TensorFlow 2.10.0 (or backport commits for 2.9.1/2.8.1/2.7.2) — this is the only fix.

  2. Audit all model serving endpoints: identify which models route user input through DenseBincount and enforce input shape validation at the API layer before tensor construction.

  3. Configure process supervisors (Kubernetes restartPolicy: Always, systemd Restart=always) to auto-restart crashed inference processes.

  4. Apply rate limiting and input size caps on inference endpoints to reduce blast radius.

  5. Scan your TF version inventory — any unpatched 2.7.x, 2.8.x, 2.9.x, or pre-2.10.0 deployment is vulnerable.

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 9 - Risk management system
ISO 42001
Clause 8.4 - AI system operation and monitoring
NIST AI RMF
MANAGE 2.2 - Mechanisms for sustaining AI system trustworthiness during operation
OWASP LLM Top 10
LLM04 - Model Denial of Service

Frequently Asked Questions

What is CVE-2022-35987?

Any unauthenticated attacker can crash TensorFlow inference processes by sending a malformed weights tensor to any endpoint that invokes DenseBincount — no ML knowledge required. Patch to TF 2.10.0, 2.9.1, 2.8.1, or 2.7.2 immediately; no workaround exists. Prioritize externally exposed TF Serving deployments and any model API that accepts user-controlled tensor inputs.

Is CVE-2022-35987 actively exploited?

Proof-of-concept exploit code is publicly available for CVE-2022-35987, increasing the risk of exploitation.

How to fix CVE-2022-35987?

1. Patch to TensorFlow 2.10.0 (or backport commits for 2.9.1/2.8.1/2.7.2) — this is the only fix. 2. Audit all model serving endpoints: identify which models route user input through DenseBincount and enforce input shape validation at the API layer before tensor construction. 3. Configure process supervisors (Kubernetes restartPolicy: Always, systemd Restart=always) to auto-restart crashed inference processes. 4. Apply rate limiting and input size caps on inference endpoints to reduce blast radius. 5. Scan your TF version inventory — any unpatched 2.7.x, 2.8.x, 2.9.x, or pre-2.10.0 deployment is vulnerable.

What systems are affected by CVE-2022-35987?

This vulnerability affects the following AI/ML architecture patterns: model serving, training pipelines, inference.

What is the CVSS score for CVE-2022-35987?

CVE-2022-35987 has a CVSS v3.1 base score of 7.5 (HIGH). The EPSS exploitation probability is 0.38%.

What is the AI security impact?

Affected AI Architectures

model servingtraining pipelinesinference

MITRE ATLAS Techniques

AML.T0029 Denial of AI Service
AML.T0034 Cost Harvesting
AML.T0049 Exploit Public-Facing Application

Compliance Controls Affected

EU AI Act: Article 9
ISO 42001: Clause 8.4
NIST AI RMF: MANAGE 2.2
OWASP LLM Top 10: LLM04

What are the technical details?

Original Advisory

TensorFlow is an open source platform for machine learning. `DenseBincount` assumes its input tensor `weights` to either have the same shape as its input tensor `input` or to be length-0. A different `weights` shape will trigger a `CHECK` fail that can be used to trigger a denial of service attack. We have patched the issue in GitHub commit bf4c14353c2328636a18bfad1e151052c81d5f43. 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 attacker probes a public recommendation API backed by TensorFlow. They identify that the endpoint accepts item weight vectors alongside item IDs. By crafting a request where the weights tensor has a different shape than the input tensor — for example, passing a weights array of length 3 against an input array of length 10 — the DenseBincount CHECK assertion fires, immediately killing the TF Serving process. The attacker repeats this at low frequency (one request per minute) to prevent recovery. No ML expertise needed: the attacker only needs to know the endpoint accepts tensor inputs and that the target runs unpatched TensorFlow.

Weaknesses (CWE)

CWE-617 — Reachable Assertion: The product contains an assert() or similar statement that can be triggered by an attacker, which leads to an application exit or other behavior that is more severe than necessary.

  • [Implementation] Make sensitive open/close operation non reachable by directly user-controlled data (e.g. open/close resources)
  • [Implementation] Perform input validation on user data.

Source: MITRE CWE corpus.

CVSS Vector

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

Timeline

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

Related Vulnerabilities