CVE-2022-23587: TensorFlow: integer overflow in Grappler enables RCE
CRITICAL PoC AVAILABLE CISA: ATTENDPatch TensorFlow immediately to 2.8.0, 2.7.1, 2.6.3, or 2.5.3. This CVSS 9.8 flaw in the Grappler optimizer allows unauthenticated remote attackers to trigger undefined behavior via malicious crop/resize parameters—any TensorFlow serving endpoint accepting user-controlled image inputs is exposed. Audit all TensorFlow versions in your ML stack and treat this as a production-blocking upgrade.
What is the risk?
Severity is maximum: CVSS 9.8 with no authentication, no user interaction, and network reachability. The integer overflow in Grappler's cost estimator for crop-and-resize is user-triggered, meaning any ML inference API or data pipeline that accepts image cropping parameters from external sources is exploitable without special privileges. Blast radius is broad—TensorFlow is the dominant ML framework, and many organizations run unpatched versions in production model serving. The undefined behavior outcome (potential RCE or crash) makes this unpredictable and dangerous.
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, 2.7.1, 2.6.3, or 2.5.3 immediately—patches are available for all supported branches.
-
Inventory all TensorFlow instances across ML infrastructure (training servers, serving clusters, notebooks, CI/CD pipelines).
-
As interim workaround: validate and clamp crop box coordinates and aspect ratios at the API boundary before passing to TensorFlow ops.
-
Enable runtime monitoring for abnormal crash patterns or OOM events in TF Serving processes.
-
Apply least-privilege isolation to TF Serving containers to limit blast radius if exploited.
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-23587?
Patch TensorFlow immediately to 2.8.0, 2.7.1, 2.6.3, or 2.5.3. This CVSS 9.8 flaw in the Grappler optimizer allows unauthenticated remote attackers to trigger undefined behavior via malicious crop/resize parameters—any TensorFlow serving endpoint accepting user-controlled image inputs is exposed. Audit all TensorFlow versions in your ML stack and treat this as a production-blocking upgrade.
Is CVE-2022-23587 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2022-23587, increasing the risk of exploitation.
How to fix CVE-2022-23587?
1. Upgrade TensorFlow to 2.8.0, 2.7.1, 2.6.3, or 2.5.3 immediately—patches are available for all supported branches. 2. Inventory all TensorFlow instances across ML infrastructure (training servers, serving clusters, notebooks, CI/CD pipelines). 3. As interim workaround: validate and clamp crop box coordinates and aspect ratios at the API boundary before passing to TensorFlow ops. 4. Enable runtime monitoring for abnormal crash patterns or OOM events in TF Serving processes. 5. Apply least-privilege isolation to TF Serving containers to limit blast radius if exploited.
What systems are affected by CVE-2022-23587?
This vulnerability affects the following AI/ML architecture patterns: model serving, training pipelines, inference APIs, computer vision pipelines, ML preprocessing pipelines.
What is the CVSS score for CVE-2022-23587?
CVE-2022-23587 has a CVSS v3.1 base score of 9.8 (CRITICAL). The EPSS exploitation probability is 0.87%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.001 AI Software 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. Under certain scenarios, Grappler component of TensorFlow is vulnerable to an integer overflow during cost estimation for crop and resize. Since the cropping parameters are user controlled, a malicious person can trigger undefined behavior. 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 targets an image processing microservice backed by TensorFlow (e.g., a product photo classifier or medical scan analyzer). They craft a request with extreme or mathematically adversarial crop box values—coordinates near integer boundaries—that trigger overflow in Grappler's op_level_cost_estimator during graph optimization. The resulting undefined behavior causes memory corruption, enabling potential arbitrary code execution within the TF Serving process. With CVSS PR:N/UI:N, this requires no account or user interaction—just a crafted HTTP payload to the inference endpoint.
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:N/UI:N/S:U/C:H/I:H/A:H References
- github.com/tensorflow/tensorflow/blob/a1320ec1eac186da1d03f033109191f715b2b130/tensorflow/core/grappler/costs/op_level_cost_estimator.cc Exploit 3rd Party
- github.com/tensorflow/tensorflow/commit/0aaaae6eca5a7175a193696383f582f53adab23f Patch 3rd Party
- github.com/tensorflow/tensorflow/security/advisories/GHSA-8jj7-5vxc-pg2q 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-35939 9.8 TensorFlow: ScatterNd OOB write enables RCE/crash
Same package: tensorflow