CVE-2022-21728: TensorFlow: heap OOB read in ReverseSequence op
HIGH PoC AVAILABLE CISA: TRACK*Upgrade TensorFlow to 2.8.0, 2.7.1, 2.6.3, or 2.5.3 immediately. A low-privileged authenticated attacker can send a crafted request to any TF inference endpoint, triggering a heap out-of-bounds read in ReverseSequence shape inference—resulting in memory disclosure or service crash. Multi-tenant ML platforms where users share a TF runtime are at highest risk and should prioritize patching or workload isolation.
Risk Assessment
High risk for organizations exposing TensorFlow-based inference APIs to authenticated but partially-trusted users. CVSS 8.1 with network attack vector and low privilege requirement means any authenticated tenant on a shared ML platform can trigger this. Low attack complexity makes opportunistic exploitation realistic once an attacker knows the vector. No CISA KEV entry and no public exploit PoC reduces immediate urgency, but the CVSS profile warrants patching within your standard high-severity SLA.
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 cherrypick backports to 2.7.1, 2.6.3, 2.5.3).
-
DETECT
Audit logs for shape inference exceptions or unexpected TF worker crashes—these may indicate exploit attempts.
-
WORKAROUND (if patching delayed): Add server-side input validation to reject negative batch_dim values before passing user-controlled tensors to TF ops.
-
ISOLATE
Run TF inference workers in per-tenant containers to limit blast radius of any memory disclosure.
-
INVENTORY
Identify all internal services consuming TensorFlow as a dependency, including ML pipelines, notebooks, and model servers.
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-21728?
Upgrade TensorFlow to 2.8.0, 2.7.1, 2.6.3, or 2.5.3 immediately. A low-privileged authenticated attacker can send a crafted request to any TF inference endpoint, triggering a heap out-of-bounds read in ReverseSequence shape inference—resulting in memory disclosure or service crash. Multi-tenant ML platforms where users share a TF runtime are at highest risk and should prioritize patching or workload isolation.
Is CVE-2022-21728 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2022-21728, increasing the risk of exploitation.
How to fix CVE-2022-21728?
1. PATCH: Upgrade to TensorFlow 2.8.0 (or cherrypick backports to 2.7.1, 2.6.3, 2.5.3). 2. DETECT: Audit logs for shape inference exceptions or unexpected TF worker crashes—these may indicate exploit attempts. 3. WORKAROUND (if patching delayed): Add server-side input validation to reject negative batch_dim values before passing user-controlled tensors to TF ops. 4. ISOLATE: Run TF inference workers in per-tenant containers to limit blast radius of any memory disclosure. 5. INVENTORY: Identify all internal services consuming TensorFlow as a dependency, including ML pipelines, notebooks, and model servers.
What systems are affected by CVE-2022-21728?
This vulnerability affects the following AI/ML architecture patterns: model serving, training pipelines, inference endpoints, shared ML platforms.
What is the CVSS score for CVE-2022-21728?
CVE-2022-21728 has a CVSS v3.1 base score of 8.1 (HIGH). The EPSS exploitation probability is 1.08%.
Technical Details
NVD Description
Tensorflow is an Open Source Machine Learning Framework. The implementation of shape inference for `ReverseSequence` does not fully validate the value of `batch_dim` and can result in a heap OOB read. There is a check to make sure the value of `batch_dim` does not go over the rank of the input, but there is no check for negative values. Negative dimensions are allowed in some cases to mimic Python's negative indexing (i.e., indexing from the end of the array), however if the value is too negative then the implementation of `Dim` would access elements before the start of an array. 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 authenticated access to a model serving endpoint (e.g., TF Serving, a custom FastAPI inference wrapper, or a shared Jupyter environment) submits an inference request containing a ReverseSequence op where batch_dim is set to a large negative integer (e.g., -999). TensorFlow's shape inference calls Dim() without validating the negative value, causing a read at a memory address before the array's start. Depending on memory layout, the service either returns an error response leaking partial heap contents (process memory, potentially including API keys or tensor data from other tenants) or crashes the inference worker entirely. In a SageMaker or Vertex AI multi-model server, this could allow one model's endpoint to crash shared infrastructure or leak data across tenants.
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/framework/shape_inference.h Exploit 3rd Party
- github.com/tensorflow/tensorflow/blob/5100e359aef5c8021f2e71c7b986420b85ce7b3d/tensorflow/core/ops/array_ops.cc Exploit 3rd Party
- github.com/tensorflow/tensorflow/commit/37c01fb5e25c3d80213060460196406c43d31995 Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-6gmv-pjp9-p8w8 Patch 3rd Party
- github.com/ARPSyndicate/cvemon Exploit
- github.com/NaInSec/CVE-PoC-in-GitHub Exploit
- github.com/SYRTI/POC_to_review Exploit
- github.com/WhooAmii/POC_to_review Exploit
- github.com/k0mi-tg/CVE-POC Exploit
- github.com/manas3c/CVE-POC Exploit
- github.com/mwina/CVE-2022-21728-test Exploit
- github.com/nomi-sec/PoC-in-GitHub Exploit
- github.com/trhacknon/Pocingit Exploit
- github.com/whoforget/CVE-POC Exploit
- github.com/youwizard/CVE-POC Exploit
- github.com/zecool/cve Exploit
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