CVE-2023-25664: TensorFlow: heap overflow in AvgPoolGrad, RCE risk
CRITICAL PoC AVAILABLEA critical heap buffer overflow (CVSS 9.8) in TensorFlow's TAvgPoolGrad operation is exploitable remotely with no authentication or user interaction — any exposed TensorFlow Serving endpoint is potentially vulnerable to remote code execution. Patch immediately to TensorFlow 2.12.0 or 2.11.1; if patching is blocked, isolate all TF Serving endpoints behind network controls. Treat any unpatched TF inference infrastructure as compromised until remediated.
Risk Assessment
Extremely high risk. The CVSS 9.8 score reflects the worst-case attack surface: network-accessible, zero privileges required, zero user interaction. AvgPooling layers are ubiquitous in CNN architectures (image classification, object detection, embedding models), meaning a large percentage of deployed TensorFlow models use the vulnerable code path. TensorFlow Serving is commonly exposed internally or externally in MLOps pipelines, making this trivially reachable by an attacker with network access. The heap buffer overflow primitive in a memory-unsafe C++ backend provides a credible path to full RCE.
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.12.0 or 2.11.1 on all systems. Verify with
pip show tensorfloworpip show tensorflow-gpu. -
NETWORK ISOLATION
Immediately restrict TF Serving endpoints to internal networks only; block external access at firewall/load balancer level for unpatched instances.
-
INPUT VALIDATION
Implement shape and dtype validation at the API boundary before tensors reach the TF runtime — reject inputs with unexpected tensor dimensions.
-
DETECTION
Monitor TF Serving process for crashes/segfaults (crash logs, core dumps) which may indicate exploitation attempts. Enable process-level memory protection (ASLR, stack canaries) at OS level.
-
INVENTORY
Audit all TensorFlow versions across training clusters, inference servers, CI/CD pipelines, and developer machines. Flag tensorflow<2.11.1 as critical.
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-2023-25664?
A critical heap buffer overflow (CVSS 9.8) in TensorFlow's TAvgPoolGrad operation is exploitable remotely with no authentication or user interaction — any exposed TensorFlow Serving endpoint is potentially vulnerable to remote code execution. Patch immediately to TensorFlow 2.12.0 or 2.11.1; if patching is blocked, isolate all TF Serving endpoints behind network controls. Treat any unpatched TF inference infrastructure as compromised until remediated.
Is CVE-2023-25664 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2023-25664, increasing the risk of exploitation.
How to fix CVE-2023-25664?
1. PATCH: Upgrade TensorFlow to 2.12.0 or 2.11.1 on all systems. Verify with `pip show tensorflow` or `pip show tensorflow-gpu`. 2. NETWORK ISOLATION: Immediately restrict TF Serving endpoints to internal networks only; block external access at firewall/load balancer level for unpatched instances. 3. INPUT VALIDATION: Implement shape and dtype validation at the API boundary before tensors reach the TF runtime — reject inputs with unexpected tensor dimensions. 4. DETECTION: Monitor TF Serving process for crashes/segfaults (crash logs, core dumps) which may indicate exploitation attempts. Enable process-level memory protection (ASLR, stack canaries) at OS level. 5. INVENTORY: Audit all TensorFlow versions across training clusters, inference servers, CI/CD pipelines, and developer machines. Flag tensorflow<2.11.1 as critical.
What systems are affected by CVE-2023-25664?
This vulnerability affects the following AI/ML architecture patterns: model serving, training pipelines, inference APIs, ML development environments.
What is the CVSS score for CVE-2023-25664?
CVE-2023-25664 has a CVSS v3.1 base score of 9.8 (CRITICAL). The EPSS exploitation probability is 0.09%.
Technical Details
NVD Description
TensorFlow is an open source platform for machine learning. Prior to versions 2.12.0 and 2.11.1, there is a heap buffer overflow in TAvgPoolGrad. A fix is included in TensorFlow 2.12.0 and 2.11.1.
Exploitation Scenario
An attacker identifies a TensorFlow Serving instance (default ports 8500/8501) exposed on an internal ML platform or via a misconfigured cloud security group. They send a crafted gRPC or REST inference request containing malformed tensor inputs designed to trigger the TAvgPoolGrad backward pass with invalid buffer dimensions. The heap buffer overflow corrupts adjacent memory, enabling controlled write primitives. With moderate exploit development effort, this achieves RCE under the TF Serving process account — which in MLOps environments often has broad access to model artifacts, training data stores, and cloud credentials. No credentials or prior access are required.
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/commit/ddaac2bdd099bec5d7923dea45276a7558217e5b Patch
- github.com/tensorflow/tensorflow/security/advisories/GHSA-6hg6-5c2q-7rcr Patch
- github.com/Tonaram/DSS-BufferOverflow Exploit
- github.com/YoussefJeridi/vulTenserflow Exploit
- github.com/YoussefJeridi/vulTensorflow 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