CVE-2022-21730: TensorFlow: OOB read leaks heap memory, enables DoS
HIGH PoC AVAILABLE CISA: TRACK*TensorFlow versions before 2.8.0 allow a low-privileged remote attacker to trigger an out-of-bounds heap read via malformed tensor inputs to FractionalAvgPoolGrad, leaking memory contents or crashing the process. Upgrade to TensorFlow 2.8.0 immediately; backport patches are available for 2.7.1, 2.6.3, and 2.5.3. Any deployment exposing TensorFlow training or inference endpoints to untrusted input is directly at risk.
Risk Assessment
High risk (CVSS 8.1) due to network exploitability with low complexity and no user interaction required. The exploit path and fix commit are publicly documented, making exploitation straightforward for any attacker familiar with TensorFlow's tensor API. Not in CISA KEV and published in 2022, but unpatched deployments remain fully exposed. Organizations running model inference APIs or multi-tenant training platforms accepting external input without strict shape validation face immediate confidentiality and availability impact.
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 the backport commit (002408c3696b) to 2.7.1, 2.6.3, or 2.5.3.
-
Input validation: Enforce strict tensor shape and dtype validation at all API boundaries before passing inputs to TF ops.
-
Sandboxing: Run TensorFlow serving processes in isolated containers or VMs to limit blast radius of any memory disclosure.
-
Least privilege: Restrict which users or services can invoke custom or pooling-related ops on shared infrastructure.
-
Detection: Alert on abnormal OOM errors, segfaults, or crash loops in TF serving logs, which may indicate active exploitation attempts.
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-21730?
TensorFlow versions before 2.8.0 allow a low-privileged remote attacker to trigger an out-of-bounds heap read via malformed tensor inputs to FractionalAvgPoolGrad, leaking memory contents or crashing the process. Upgrade to TensorFlow 2.8.0 immediately; backport patches are available for 2.7.1, 2.6.3, and 2.5.3. Any deployment exposing TensorFlow training or inference endpoints to untrusted input is directly at risk.
Is CVE-2022-21730 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2022-21730, increasing the risk of exploitation.
How to fix CVE-2022-21730?
1. Patch: Upgrade to TensorFlow 2.8.0 or apply the backport commit (002408c3696b) to 2.7.1, 2.6.3, or 2.5.3. 2. Input validation: Enforce strict tensor shape and dtype validation at all API boundaries before passing inputs to TF ops. 3. Sandboxing: Run TensorFlow serving processes in isolated containers or VMs to limit blast radius of any memory disclosure. 4. Least privilege: Restrict which users or services can invoke custom or pooling-related ops on shared infrastructure. 5. Detection: Alert on abnormal OOM errors, segfaults, or crash loops in TF serving logs, which may indicate active exploitation attempts.
What systems are affected by CVE-2022-21730?
This vulnerability affects the following AI/ML architecture patterns: training pipelines, model serving, MLOps platforms, inference endpoints, multi-tenant Jupyter environments.
What is the CVSS score for CVE-2022-21730?
CVE-2022-21730 has a CVSS v3.1 base score of 8.1 (HIGH). The EPSS exploitation probability is 0.32%.
Technical Details
NVD Description
Tensorflow is an Open Source Machine Learning Framework. The implementation of `FractionalAvgPoolGrad` does not consider cases where the input tensors are invalid allowing an attacker to read from outside of bounds of heap. 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-based inference service targeting a CNN model with fractional pooling layers crafts a request containing deliberately invalid tensor dimensions for the FractionalAvgPoolGrad op. The malformed tensor triggers the out-of-bounds read in the C++ kernel—no Python exception is raised. Depending on heap layout at the time of exploitation, the attacker may read adjacent memory containing model weights, cached training batch data, or credentials stored in the process heap. Alternatively, the attacker repeatedly sends malformed tensors to crash the serving process, causing sustained denial of service against production ML endpoints.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:H References
- github.com/tensorflow/tensorflow/blob/5100e359aef5c8021f2e71c7b986420b85ce7b3d/tensorflow/core/kernels/fractional_avg_pool_op.cc Exploit 3rd Party
- github.com/tensorflow/tensorflow/commit/002408c3696b173863228223d535f9de72a101a9 Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-vjg4-v33c-ggc4 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