CVE-2022-21726: TensorFlow: heap OOB read in Dequantize op allows RCE
HIGH PoC AVAILABLE CISA: TRACK*Any TensorFlow deployment accepting external inference requests with quantized models is exposed to this heap out-of-bounds read. With CVSS 8.8, network-exploitable with low privilege requirements, an authenticated API caller can crash your inference servers or potentially achieve code execution. Patch to TF 2.8.0, 2.7.1, 2.6.3, or 2.5.3 immediately and restrict API access to inference endpoints.
Risk Assessment
High severity (CVSS 8.8). Network-accessible TensorFlow Serving instances are the primary attack surface. Low attack complexity and minimal privilege requirements—any authenticated API user—make exploitation accessible to moderately skilled attackers. The OOB read in a heap-allocated dimensions array with C:H/I:H/A:H impact scoring indicates potential for memory disclosure escalating to RCE. Production AI inference deployments using quantized models—common in optimized serving and edge AI scenarios—are directly and broadly exposed.
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 TensorFlow to 2.8.0, or apply backport patches to 2.7.1, 2.6.3, or 2.5.3—commit 23968a8b is the authoritative fix.
-
DETECT
Monitor TF Serving access logs for requests triggering Dequantize with anomalously large axis values; elevated error rates on quantization ops are an early signal.
-
RESTRICT
Apply input validation at the API gateway layer enforcing axis parameter bounds before reaching TF kernels.
-
ISOLATE
Run TF Serving in isolated containers with memory limits to contain heap exploit blast radius.
-
AUDIT
TF is often embedded transitively in higher-level frameworks (Keras, TFX, ML pipelines); verify the full dependency tree is patched.
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-21726?
Any TensorFlow deployment accepting external inference requests with quantized models is exposed to this heap out-of-bounds read. With CVSS 8.8, network-exploitable with low privilege requirements, an authenticated API caller can crash your inference servers or potentially achieve code execution. Patch to TF 2.8.0, 2.7.1, 2.6.3, or 2.5.3 immediately and restrict API access to inference endpoints.
Is CVE-2022-21726 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2022-21726, increasing the risk of exploitation.
How to fix CVE-2022-21726?
1. PATCH: Upgrade TensorFlow to 2.8.0, or apply backport patches to 2.7.1, 2.6.3, or 2.5.3—commit 23968a8b is the authoritative fix. 2. DETECT: Monitor TF Serving access logs for requests triggering Dequantize with anomalously large axis values; elevated error rates on quantization ops are an early signal. 3. RESTRICT: Apply input validation at the API gateway layer enforcing axis parameter bounds before reaching TF kernels. 4. ISOLATE: Run TF Serving in isolated containers with memory limits to contain heap exploit blast radius. 5. AUDIT: TF is often embedded transitively in higher-level frameworks (Keras, TFX, ML pipelines); verify the full dependency tree is patched.
What systems are affected by CVE-2022-21726?
This vulnerability affects the following AI/ML architecture patterns: model serving, inference pipelines, training pipelines, edge AI deployment.
What is the CVSS score for CVE-2022-21726?
CVE-2022-21726 has a CVSS v3.1 base score of 8.8 (HIGH). The EPSS exploitation probability is 0.29%.
Technical Details
NVD Description
Tensorflow is an Open Source Machine Learning Framework. The implementation of `Dequantize` does not fully validate the value of `axis` and can result in heap OOB accesses. The `axis` argument can be `-1` (the default value for the optional argument) or any other positive value at most the number of dimensions of the input. Unfortunately, the upper bound is not checked and this results in reading past the end of the array containing the dimensions of the input tensor. 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 REST endpoint submits a crafted inference request containing a quantized tensor with the axis parameter set to a value exceeding the tensor's actual dimensionality. The Dequantize kernel reads past the end of the heap-allocated dimensions array without upper-bound validation, triggering memory disclosure or a crash. In a targeted attack, the adversary iterates over axis values to probe adjacent heap memory, potentially exposing model weights, credentials stored in memory, or constructing a write primitive for full code execution. The low attack complexity means this requires only a valid API key or access to an unauthenticated TF Serving endpoint.
Weaknesses (CWE)
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H References
- github.com/tensorflow/tensorflow/blob/5100e359aef5c8021f2e71c7b986420b85ce7b3d/tensorflow/core/kernels/dequantize_op.cc Exploit 3rd Party
- github.com/tensorflow/tensorflow/commit/23968a8bf65b009120c43b5ebcceaf52dbc9e943 Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-23hm-7w47-xw72 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