CVE-2022-21732: TensorFlow: ThreadPoolHandle DoS via memory exhaustion
MEDIUM PoC AVAILABLEAny TensorFlow deployment where authenticated users can influence thread pool parameters is at risk of intentional resource exhaustion and service crash. The fix is straightforward: patch to TF 2.8.0, 2.7.1, 2.6.3, or 2.5.3. Prioritize shared training clusters and TF-serving instances accessible to multiple users or external inputs.
Risk Assessment
CVSS 6.5 Medium understates operational risk in multi-tenant ML infrastructure. Network-accessible, low-complexity, low-privilege exploitation means any authenticated API consumer can trigger it reliably. No code execution or data exfiltration, but availability impact can cascade to downstream model serving SLAs and batch training pipelines. Risk is elevated in organizations running TensorFlow-as-a-service or shared GPU clusters.
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 immediately: upgrade to TensorFlow 2.8.0, or cherrypicked fixes in 2.7.1, 2.6.3, 2.5.3.
-
Workaround if patching is blocked: enforce server-side validation of num_threads before passing to TF ops (cap at logical CPU count * reasonable_multiplier).
-
In multi-tenant environments, restrict direct access to low-level tf.data experimental APIs via API gateway input sanitization.
-
Detection: alert on OOM events in TF processes correlated with num_threads values exceeding vCPU count * 10x.
-
Audit any user-supplied integer parameters flowing into TF data pipeline constructors.
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-21732?
Any TensorFlow deployment where authenticated users can influence thread pool parameters is at risk of intentional resource exhaustion and service crash. The fix is straightforward: patch to TF 2.8.0, 2.7.1, 2.6.3, or 2.5.3. Prioritize shared training clusters and TF-serving instances accessible to multiple users or external inputs.
Is CVE-2022-21732 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2022-21732, increasing the risk of exploitation.
How to fix CVE-2022-21732?
1. Patch immediately: upgrade to TensorFlow 2.8.0, or cherrypicked fixes in 2.7.1, 2.6.3, 2.5.3. 2. Workaround if patching is blocked: enforce server-side validation of num_threads before passing to TF ops (cap at logical CPU count * reasonable_multiplier). 3. In multi-tenant environments, restrict direct access to low-level tf.data experimental APIs via API gateway input sanitization. 4. Detection: alert on OOM events in TF processes correlated with num_threads values exceeding vCPU count * 10x. 5. Audit any user-supplied integer parameters flowing into TF data pipeline constructors.
What systems are affected by CVE-2022-21732?
This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, data preprocessing pipelines, shared ML compute clusters.
What is the CVSS score for CVE-2022-21732?
CVE-2022-21732 has a CVSS v3.1 base score of 6.5 (MEDIUM). The EPSS exploitation probability is 0.22%.
Technical Details
NVD Description
Tensorflow is an Open Source Machine Learning Framework. The implementation of `ThreadPoolHandle` can be used to trigger a denial of service attack by allocating too much memory. This is because the `num_threads` argument is only checked to not be negative, but there is no upper bound on its value. 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
Adversary with low-privilege access to a shared TensorFlow training platform or model-serving API submits a crafted tf.data pipeline definition embedding a ThreadPoolHandle with num_threads set to a value near INT_MAX (2147483647). TensorFlow validates only that the value is non-negative and proceeds to allocate memory proportional to the thread count. The process exhausts available RAM within seconds, triggering an OOM kill. In a Kubernetes-managed serving cluster, this crashes the pod; in a shared training cluster, it kills the worker process and may corrupt in-progress checkpoints. Attack requires only valid API credentials and knowledge of the tf.data API surface — both publicly documented.
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/kernels/data/experimental/threadpool_dataset_op.cc Exploit 3rd Party
- github.com/tensorflow/tensorflow/commit/e3749a6d5d1e8d11806d4a2e9cc3123d1a90b75e Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-c582-c96p-r5cq 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