CVE-2022-21734: TensorFlow: DoS via MapStage non-scalar key crash
MEDIUM PoC AVAILABLE CISA: TRACK*A low-privilege network attacker can crash any TensorFlow serving instance using the MapStage op by sending a non-scalar key tensor, triggering a process-aborting CHECK failure. Patch to TF 2.8.0, 2.7.1, 2.6.3, or 2.5.3 immediately. If patching is delayed, restrict inference API access to authenticated internal users only.
What is the risk?
Medium severity but operationally significant for production AI serving. CVSS 6.5 (AV:N/AC:L/PR:L) means any network-reachable TF inference API can be crashed with minimal skill. Only availability is impacted — no data exfiltration risk. Effective risk elevates if TF Serving is internet-exposed, lacks restart resilience, or if AI service uptime is tied to SLA obligations or regulated system operation.
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.8.0 or backports 2.7.1, 2.6.3, 2.5.3.
-
Validate inputs: Enforce scalar key constraints at API boundaries before tensors reach MapStage.
-
Harden access: Require authentication (API keys, mutual TLS) on all TF Serving endpoints — PR:L means any credentialed user can trigger this.
-
Detect: Alert on abnormal TF serving worker restarts — repeated crashes in a short window signal active exploitation.
-
Containerize with limits: Set restart limits and exponential backoff in Kubernetes to prevent crash loops from amplifying DoS impact.
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-21734?
A low-privilege network attacker can crash any TensorFlow serving instance using the MapStage op by sending a non-scalar key tensor, triggering a process-aborting CHECK failure. Patch to TF 2.8.0, 2.7.1, 2.6.3, or 2.5.3 immediately. If patching is delayed, restrict inference API access to authenticated internal users only.
Is CVE-2022-21734 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2022-21734, increasing the risk of exploitation.
How to fix CVE-2022-21734?
1. Patch: Upgrade to TensorFlow 2.8.0 or backports 2.7.1, 2.6.3, 2.5.3. 2. Validate inputs: Enforce scalar key constraints at API boundaries before tensors reach MapStage. 3. Harden access: Require authentication (API keys, mutual TLS) on all TF Serving endpoints — PR:L means any credentialed user can trigger this. 4. Detect: Alert on abnormal TF serving worker restarts — repeated crashes in a short window signal active exploitation. 5. Containerize with limits: Set restart limits and exponential backoff in Kubernetes to prevent crash loops from amplifying DoS impact.
What systems are affected by CVE-2022-21734?
This vulnerability affects the following AI/ML architecture patterns: model serving, training pipelines, inference APIs.
What is the CVSS score for CVE-2022-21734?
CVE-2022-21734 has a CVSS v3.1 base score of 6.5 (MEDIUM). The EPSS exploitation probability is 0.77%.
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 Machine Learning Framework. The implementation of `MapStage` is vulnerable a `CHECK`-fail if the key tensor is not a scalar. The fix will be included in TensorFlow 2.8.0. We will also cherrypick this commit on TensorFlow 2.7.1, TensorFlow 2.6.3, and TensorFlow 2.5.3, as these are also affected and still in supported range.
Exploitation Scenario
An attacker with a valid low-privilege API key to a TF Serving endpoint sends a crafted inference request with a non-scalar tensor (e.g., a 2D matrix) as the MapStage key. The MapStage kernel hits its CHECK assertion, immediately aborting the TensorFlow process. In a Kubernetes deployment without crash loop backoff, the container restarts indefinitely, creating a sustained denial-of-service that kills model availability. No ML expertise is required — only knowledge of the TFX/TF Serving proto schema, which is publicly documented. Automation is trivial: a single script can maintain continuous service disruption.
Weaknesses (CWE)
CWE-843 Access of Resource Using Incompatible Type ('Type Confusion')
Primary
CWE-843 Access of Resource Using Incompatible Type ('Type Confusion') CWE-843 — Access of Resource Using Incompatible Type ('Type Confusion'): The product allocates or initializes a resource such as a pointer, object, or variable using one type, but it later accesses that resource using a type that is incompatible with the original type.
Source: MITRE CWE corpus.
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H References
- github.com/tensorflow/tensorflow/blob/5100e359aef5c8021f2e71c7b986420b85ce7b3d/tensorflow/core/kernels/map_stage_op.cc Exploit 3rd Party
- github.com/tensorflow/tensorflow/commit/f57315566d7094f322b784947093406c2aea0d7d Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-gcvh-66ff-4mwm 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