CVE-2022-21731: TensorFlow: ConcatV2 type confusion enables remote DoS
MEDIUM PoC AVAILABLE CISA: TRACK*Any TensorFlow deployment exposing model inference via an API is vulnerable to a crash triggered by a malformed ConcatV2 axis argument — no authentication bypass needed, just low-privilege access. Patch immediately to TF 2.8.0 (or cherrypick backports for 2.5–2.7). If you cannot patch now, add input validation middleware to reject negative axis values on ConcatV2 operations at the serving layer.
Risk Assessment
Medium severity by CVSS (6.5), but operationally significant for production ML environments. The attack requires only low privileges and no user interaction, meaning any authenticated API user can crash a TensorFlow serving process. In multi-tenant inference platforms or shared training clusters, this becomes a lateral disruption risk — one malicious or compromised tenant can take down shared infrastructure. Not currently in CISA KEV and no evidence of active exploitation, but the exploit path is straightforward given public PoC references in the advisory.
Affected Systems
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| tensorflow | pip | — | No patch |
Do you use tensorflow? You're affected.
Severity & Risk
Attack Surface
Recommended Action
5 steps-
PATCH
Upgrade to TensorFlow 2.8.0, or apply backport commits to 2.7.1, 2.6.3, or 2.5.3. Commit 08d7b00 contains the fix.
-
WORKAROUND
Validate that axis arguments for ConcatV2 operations are non-negative integers before execution; reject requests with negative axis values at the API gateway or input validation layer.
-
ISOLATION
Run TF Serving in containers with automatic restart policies (e.g., Kubernetes Deployment with restartPolicy: Always) to minimize MTTR if exploited.
-
DETECTION
Monitor for sudden TF process terminations (segfaults in logs) or spikes in inference API 5xx errors — these may indicate exploitation attempts.
-
NETWORK CONTROLS
Restrict TF Serving API access to trusted clients only; avoid exposing raw graph execution APIs to untrusted users.
CISA SSVC Assessment
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
Classification
Compliance Impact
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2022-21731?
Any TensorFlow deployment exposing model inference via an API is vulnerable to a crash triggered by a malformed ConcatV2 axis argument — no authentication bypass needed, just low-privilege access. Patch immediately to TF 2.8.0 (or cherrypick backports for 2.5–2.7). If you cannot patch now, add input validation middleware to reject negative axis values on ConcatV2 operations at the serving layer.
Is CVE-2022-21731 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2022-21731, increasing the risk of exploitation.
How to fix CVE-2022-21731?
1. PATCH: Upgrade to TensorFlow 2.8.0, or apply backport commits to 2.7.1, 2.6.3, or 2.5.3. Commit 08d7b00 contains the fix. 2. WORKAROUND: Validate that axis arguments for ConcatV2 operations are non-negative integers before execution; reject requests with negative axis values at the API gateway or input validation layer. 3. ISOLATION: Run TF Serving in containers with automatic restart policies (e.g., Kubernetes Deployment with restartPolicy: Always) to minimize MTTR if exploited. 4. DETECTION: Monitor for sudden TF process terminations (segfaults in logs) or spikes in inference API 5xx errors — these may indicate exploitation attempts. 5. NETWORK CONTROLS: Restrict TF Serving API access to trusted clients only; avoid exposing raw graph execution APIs to untrusted users.
What systems are affected by CVE-2022-21731?
This vulnerability affects the following AI/ML architecture patterns: model serving, training pipelines, ML platform APIs.
What is the CVSS score for CVE-2022-21731?
CVE-2022-21731 has a CVSS v3.1 base score of 6.5 (MEDIUM). The EPSS exploitation probability is 0.30%.
Technical Details
NVD Description
Tensorflow is an Open Source Machine Learning Framework. The implementation of shape inference for `ConcatV2` can be used to trigger a denial of service attack via a segfault caused by a type confusion. The `axis` argument is translated into `concat_dim` in the `ConcatShapeHelper` helper function. Then, a value for `min_rank` is computed based on `concat_dim`. This is then used to validate that the `values` tensor has at least the required rank. However, `WithRankAtLeast` receives the lower bound as a 64-bits value and then compares it against the maximum 32-bits integer value that could be represented. Due to the fact that `min_rank` is a 32-bits value and the value of `axis`, the `rank` argument is a negative value, so the error check is bypassed. 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 adversary with low-privilege API access to a TensorFlow Serving endpoint submits an inference request that includes a ConcatV2 operation with a crafted negative axis value (e.g., axis=-2147483648). The shape inference path translates this into a negative min_rank value, which when cast to 64-bit for comparison bypasses the rank validation check in WithRankAtLeast. TensorFlow proceeds with invalid state, causing a segfault that crashes the serving process. In a shared ML platform scenario, an attacker could repeatedly trigger this to maintain availability disruption against other tenants, or use it to force a service restart during a coordinated attack window.
Weaknesses (CWE)
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/framework/common_shape_fns.cc Exploit 3rd Party
- github.com/tensorflow/tensorflow/blob/5100e359aef5c8021f2e71c7b986420b85ce7b3d/tensorflow/core/framework/shape_inference.cc Exploit 3rd Party
- github.com/tensorflow/tensorflow/commit/08d7b00c0a5a20926363849f611729f53f3ec022 Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-m4hf-j54p-p353 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
AI Threat Alert