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.
What is the risk?
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.
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 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.
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-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.80%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.001 AI Software AML.T0025 Exfiltration via Cyber Means 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 `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)
CWE-125 — Out-of-bounds Read: The product reads data past the end, or before the beginning, of the intended buffer.
- [Implementation] Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylis
- [Architecture and Design] Use a language that provides appropriate memory abstractions.
Source: MITRE CWE corpus.
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