CVE-2022-21727: TensorFlow: Dequantize integer overflow, RCE risk
HIGH PoC AVAILABLE CISA: TRACK*TensorFlow < 2.8.0 has an exploitable integer overflow in the Dequantize op's shape inference, allowing any authenticated network user to corrupt memory and potentially execute arbitrary code on your serving infrastructure. Organizations running quantized TensorFlow models in production—common for latency/cost optimization—are directly exposed. Patch immediately to TF 2.8.0, 2.7.1, 2.6.3, or 2.5.3.
What is the risk?
High risk for organizations with network-exposed TensorFlow serving infrastructure. CVSS 8.8 with AV:N/AC:L/PR:L means any low-privilege authenticated user can trigger this with a single crafted request—no specialist AI/ML knowledge required. Quantized models are ubiquitous in production deployments for inference efficiency, broadening the attack surface significantly. Not in CISA KEV and published in 2022, so urgency depends on whether affected TF versions are still running.
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-
Upgrade TensorFlow to 2.8.0 or apply cherry-picked fixes to 2.7.1, 2.6.3, or 2.5.3 (commit b64638ec5ccaa77b7c1eb90958e3d85ce381f91b).
-
Audit all services and containers for bundled TF < 2.8.0 as transitive dependencies.
-
Restrict network access to TF Serving endpoints to trusted internal principals only—apply network-level controls while patching.
-
Implement server-side input validation rejecting axis values >= number of tensor dimensions before forwarding to TF ops.
-
Monitor inference endpoint logs for shape inference errors or anomalous axis parameter values as an indicator of 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-21727?
TensorFlow < 2.8.0 has an exploitable integer overflow in the Dequantize op's shape inference, allowing any authenticated network user to corrupt memory and potentially execute arbitrary code on your serving infrastructure. Organizations running quantized TensorFlow models in production—common for latency/cost optimization—are directly exposed. Patch immediately to TF 2.8.0, 2.7.1, 2.6.3, or 2.5.3.
Is CVE-2022-21727 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2022-21727, increasing the risk of exploitation.
How to fix CVE-2022-21727?
1. Upgrade TensorFlow to 2.8.0 or apply cherry-picked fixes to 2.7.1, 2.6.3, or 2.5.3 (commit b64638ec5ccaa77b7c1eb90958e3d85ce381f91b). 2. Audit all services and containers for bundled TF < 2.8.0 as transitive dependencies. 3. Restrict network access to TF Serving endpoints to trusted internal principals only—apply network-level controls while patching. 4. Implement server-side input validation rejecting axis values >= number of tensor dimensions before forwarding to TF ops. 5. Monitor inference endpoint logs for shape inference errors or anomalous axis parameter values as an indicator of exploitation attempts.
What systems are affected by CVE-2022-21727?
This vulnerability affects the following AI/ML architecture patterns: model serving, training pipelines, quantized model inference, edge ML deployment.
What is the CVSS score for CVE-2022-21727?
CVE-2022-21727 has a CVSS v3.1 base score of 8.8 (HIGH). The EPSS exploitation probability is 0.65%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.001 AI Software AML.T0040 AI Model Inference API Access AML.T0043 Craft Adversarial Data 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 shape inference for `Dequantize` is vulnerable to an integer overflow weakness. 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, since the code computes `axis + 1`, an attacker can trigger an integer overflow. 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 endpoint—such as an internal data scientist account or a leaked service credential—crafts a gRPC or REST request invoking a Dequantize operation with an axis value exceeding the tensor's number of dimensions. The shape inference code computes axis + 1 without upper-bound validation, triggering a signed integer overflow (CWE-190). The resulting memory corruption can be leveraged for arbitrary code execution within the TF serving process. From there, the attacker gains access to model weights stored on disk, inference API credentials, and any secrets in the process environment—enabling lateral movement across the ML pipeline.
Weaknesses (CWE)
CWE-190 — Integer Overflow or Wraparound: The product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. This occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may become a very small or negative number.
- [Requirements] Ensure that all protocols are strictly defined, such that all out-of-bounds behavior can be identified simply, and require strict conformance to the protocol.
- [Requirements] Use a language that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. If possible, choose a language or compiler that performs automatic bounds checking.
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/ops/array_ops.cc Exploit 3rd Party
- github.com/tensorflow/tensorflow/commit/b64638ec5ccaa77b7c1eb90958e3d85ce381f91b Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-c6fh-56w7-fvjw 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