CVE-2022-35982: TensorFlow: DoS via invalid SparseBincount input
HIGH PoC AVAILABLETensorFlow's SparseBincount op crashes with a segfault when given malformed sparse tensor inputs, enabling unauthenticated remote DoS against any internet-exposed TF inference endpoint. Patch to TF 2.10.0, 2.9.1, 2.8.1, or 2.7.2 immediately. If patching is not immediately feasible, isolate TF serving endpoints behind authenticated API gateways and validate sparse tensor dimension consistency before forwarding requests to the model.
What is the risk?
High availability risk for organizations exposing TensorFlow inference APIs over the network. CVSS 7.5 reflects a network-exploitable, zero-auth, low-complexity exploit path with full availability impact. No confidentiality or integrity risk. Exploitability is trivial — crafting a malformed sparse tensor requires minimal ML knowledge. Risk amplifies in multi-tenant inference infrastructure or SLA-bound production ML services where a single crashing process disrupts multiple downstream consumers.
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?
1 step-
1) Patch: Upgrade to TensorFlow 2.10.0, 2.9.1, 2.8.1, or 2.7.2 (commit 40adbe4dd15b582b0210dfbf40c243a62f5119fa). 2) Defense-in-depth: Place all TF inference endpoints behind authenticated API gateways to eliminate the unauthenticated attack surface. 3) Input validation: Enforce that sparse tensor indices count matches values count and is consistent with dense_shape before forwarding to the model. 4) Detection: Monitor TF serving processes for unexpected crashes (SIGABRT/SIGSEGV); alert on repeated process restarts from the same source IP. 5) Rate limiting: Apply per-client request rate limits on inference endpoints to reduce DoS amplification potential.
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-35982?
TensorFlow's SparseBincount op crashes with a segfault when given malformed sparse tensor inputs, enabling unauthenticated remote DoS against any internet-exposed TF inference endpoint. Patch to TF 2.10.0, 2.9.1, 2.8.1, or 2.7.2 immediately. If patching is not immediately feasible, isolate TF serving endpoints behind authenticated API gateways and validate sparse tensor dimension consistency before forwarding requests to the model.
Is CVE-2022-35982 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2022-35982, increasing the risk of exploitation.
How to fix CVE-2022-35982?
1) Patch: Upgrade to TensorFlow 2.10.0, 2.9.1, 2.8.1, or 2.7.2 (commit 40adbe4dd15b582b0210dfbf40c243a62f5119fa). 2) Defense-in-depth: Place all TF inference endpoints behind authenticated API gateways to eliminate the unauthenticated attack surface. 3) Input validation: Enforce that sparse tensor indices count matches values count and is consistent with dense_shape before forwarding to the model. 4) Detection: Monitor TF serving processes for unexpected crashes (SIGABRT/SIGSEGV); alert on repeated process restarts from the same source IP. 5) Rate limiting: Apply per-client request rate limits on inference endpoints to reduce DoS amplification potential.
What systems are affected by CVE-2022-35982?
This vulnerability affects the following AI/ML architecture patterns: model serving, inference APIs, recommendation systems, NLP inference pipelines, multi-tenant ML platforms.
What is the CVSS score for CVE-2022-35982?
CVE-2022-35982 has a CVSS v3.1 base score of 7.5 (HIGH). The EPSS exploitation probability is 0.40%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.001 AI Software AML.T0029 Denial of AI Service 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. If `SparseBincount` is given inputs for `indices`, `values`, and `dense_shape` that do not make a valid sparse tensor, it results in a segfault that can be used to trigger a denial of service attack. We have patched the issue in GitHub commit 40adbe4dd15b582b0210dfbf40c243a62f5119fa. 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 identifies a public-facing TensorFlow Serving endpoint via Shodan or direct network reconnaissance running a recommendation or NLP model that internally uses SparseBincount. They craft a gRPC or REST inference request with a SparseBincount op input where the indices tensor length does not match the values tensor length, or where dense_shape is inconsistent with the provided indices. Sending this single malformed request triggers a segfault in the TF serving process, taking down the inference service. The attacker loops this request to maintain a persistent DoS with minimal resources, cycling source IPs to bypass naive rate limits. No ML expertise is required beyond knowing the op name and tensor input structure.
Weaknesses (CWE)
CWE-20 — Improper Input Validation: The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.
- [Architecture and Design] Consider using language-theoretic security (LangSec) techniques that characterize inputs using a formal language and build "recognizers" for that language. This effectively requires parsing to be a distinct layer that effectively enforces a boundary between raw input and internal data representations, instead of allowing parser code to be scattered throughout the program, where it could be subject to errors or inconsistencies that create weaknesses. [REF-1109] [REF-1110] [REF-1111]
- [Architecture and Design] Use an input validation framework such as Struts or the OWASP ESAPI Validation API. Note that using a framework does not automatically address all input validation problems; be mindful of weaknesses that could arise from misusing the framework itself (CWE-1173).
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 References
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