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.
What is the risk?
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.
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 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.
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-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.80%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.001 AI Software 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 `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)
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: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