CVE-2020-15198: TensorFlow: heap OOB in SparseCountSparseOutput ops
MEDIUM PoC AVAILABLEThis 2020 TensorFlow vulnerability allows network-accessible model serving endpoints to be crashed or potentially exploited via malformed sparse tensor inputs. If your ML infrastructure still runs TensorFlow < 2.3.1, patch immediately — this is a straightforward version bump. For teams on modern TF versions, no action required beyond confirming you are not running legacy inference infrastructure.
What is the risk?
Risk is LOW for patched environments but MEDIUM for legacy ML serving deployments that may still run TF 2.3.0 or earlier. CVSS 5.4 with AC:High means exploitation requires deliberate crafting of malformed inputs, reducing opportunistic risk. However, AI/ML serving APIs often lack input validation layers, making them more susceptible than traditional web services. The network attack vector with no privilege requirement means any caller with API access to a TF serving endpoint is a potential threat actor.
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.3.1 immediately on all training and serving infrastructure.
-
AUDIT
Inventory all TF versions across MLOps pipelines using 'pip show tensorflow' or container image scanning.
-
VALIDATE INPUTS
Add input shape validation at the serving layer — reject requests where indices and values tensors have mismatched shapes before they reach the TF runtime.
-
ISOLATE
Run TF serving processes in containers/VMs with restricted memory and without network egress to limit blast radius of exploitation.
-
DETECT
Alert on unexpected process crashes in TF serving pods — heap corruption often manifests as SIGABRT/SIGSEGV.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2020-15198?
This 2020 TensorFlow vulnerability allows network-accessible model serving endpoints to be crashed or potentially exploited via malformed sparse tensor inputs. If your ML infrastructure still runs TensorFlow < 2.3.1, patch immediately — this is a straightforward version bump. For teams on modern TF versions, no action required beyond confirming you are not running legacy inference infrastructure.
Is CVE-2020-15198 actively exploited?
Proof-of-concept exploit code is publicly available for CVE-2020-15198, increasing the risk of exploitation.
How to fix CVE-2020-15198?
1. PATCH: Upgrade TensorFlow to >= 2.3.1 immediately on all training and serving infrastructure. 2. AUDIT: Inventory all TF versions across MLOps pipelines using 'pip show tensorflow' or container image scanning. 3. VALIDATE INPUTS: Add input shape validation at the serving layer — reject requests where indices and values tensors have mismatched shapes before they reach the TF runtime. 4. ISOLATE: Run TF serving processes in containers/VMs with restricted memory and without network egress to limit blast radius of exploitation. 5. DETECT: Alert on unexpected process crashes in TF serving pods — heap corruption often manifests as SIGABRT/SIGSEGV.
What systems are affected by CVE-2020-15198?
This vulnerability affects the following AI/ML architecture patterns: model serving, training pipelines, data preprocessing pipelines, recommendation system backends.
What is the CVSS score for CVE-2020-15198?
CVE-2020-15198 has a CVSS v3.1 base score of 5.4 (MEDIUM). The EPSS exploitation probability is 0.54%.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.001 AI Software AML.T0029 Denial of AI Service AML.T0043 Craft Adversarial Data AML.T0049 Exploit Public-Facing Application Compliance Controls Affected
What are the technical details?
Original Advisory
In Tensorflow before version 2.3.1, the `SparseCountSparseOutput` implementation does not validate that the input arguments form a valid sparse tensor. In particular, there is no validation that the `indices` tensor has the same shape as the `values` one. The values in these tensors are always accessed in parallel. Thus, a shape mismatch can result in accesses outside the bounds of heap allocated buffers. The issue is patched in commit 3cbb917b4714766030b28eba9fb41bb97ce9ee02 and is released in TensorFlow version 2.3.1.
Exploitation Scenario
An adversary targeting an organization running a recommendation system on TF 2.3.0 identifies the TF Serving REST endpoint. They craft a predict request containing a sparse tensor where the indices shape is [100, 2] but the values shape is [10] — a deliberate mismatch. The SparseCountSparseOutput op accesses both tensors in parallel without bounds checking, triggering an out-of-bounds heap read/write. In the minimal exploitation path, the service crashes (DoS for the recommendation pipeline). In a more targeted scenario with heap layout knowledge, the adversary may achieve partial memory read to extract in-memory model weights or user data cached in the serving process.
Weaknesses (CWE)
CWE-119 Improper Restriction of Operations within the Bounds of a Memory Buffer
Primary
CWE-119 Improper Restriction of Operations within the Bounds of a Memory Buffer CWE-122 Heap-based Buffer Overflow CWE-119 — Improper Restriction of Operations within the Bounds of a Memory Buffer: The product performs operations on a memory buffer, but it reads from or writes to a memory location outside the buffer's intended boundary. This may result in read or write operations on unexpected memory locations that could be linked to other variables, data structures, or internal program data.
- [Requirements] Use a language that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. For example, many languages that perform their own memory management, such as Java and Perl, are not subject to buffer overflows. Other languages, such as Ada and C#, typically provide overflow protection, but the protection can be disabled by the programmer. Be wary that a language's interface to native code may still be subject to overflows, even if the language itself is theoretically safe.
- [Architecture and Design] Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. Examples include the Safe C String Library (SafeStr) by Messier and Viega [REF-57], and the Strsafe.h library from Microsoft [REF-56]. These libraries provide safer versions of overflow-prone string-handling functions.
Source: MITRE CWE corpus.
CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:L/A:N References
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