TensorFlow segment sum can crash or corrupt memory if segment IDs are unsorted

CriticalSE Fix-First Score 51/100CVE-2020-15214SE-AIV-00525Other weaknessModel serving and inferenceMade public 25 Sep 2020

Download as PDF

What this means

An attacker who can supply a TensorFlow Lite model or control the segment IDs passed to segment sum operations can crash the application or write to memory outside the intended bounds. This could lead to denial of service, data corruption, or in some cases enable further exploitation. Any service using TensorFlow Lite to process untrusted models or data is at risk.

SecurityElites Manager Brief: the decision in one minute

TensorFlow Lite has a critical memory safety bug in segment sum operations that can crash your service or corrupt memory if segment IDs are not in increasing order. You need to upgrade TensorFlow immediately if you use segment sum or accept models from untrusted sources.

SecurityElites Fix-First Score51 of 100
Our own ranking of what to fix first. Real attacks count most, then the chance of attack, then severity.
SecurityElites fix windowWithin 7 days
Critical severity. This is our suggestion from common practice; your own policy comes first.
Who should own the fixMachine learning infrastructure or platform team.
Likely effortAbout 30 minutes per environment: identify where TensorFlow is installed, upgrade to the patched version, restart the service, and verify the new version is running. Effort could be longer if you have many separate deployments or if you need to test a large mo

Questions to ask your team or supplier

  • Do we use TensorFlow Lite's segment sum operation, or do any of our models contain this operation? Can you confirm which models would be affected?
  • Where do our segment IDs come from: are they stored in models, generated from user input, or produced as outputs during inference? This determines whether a workaround is possible.
  • How quickly can we test and deploy the patched TensorFlow version in our development, staging, and production environments?

Message you can forward to the owning team

Security notice: TensorFlow segment sum can crash or corrupt memory if segment IDs are unsorted (CVE-2020-15214)

Severity: Critical
SecurityElites Fix-First Score: 51 of 100
SecurityElites fix window: Within 7 days
Action: upgrade to tensorflow 2.3.1, tensorflow-cpu 2.3.1, tensorflow-gpu 2.3.1 or later.
What we need from you: confirm whether we run this software, who owns it, and the date it will be fixed.
Full guide: https://securityelites.com/ai-vulnerabilities/cve-2020-15214-tensorflow-segment-sum-can-crash-or-corrupt-memory-if/
Source: SecurityElites AI Vulnerabilities Database, record SE-AIV-00525

What is at stake in your AI setup

  • Model files: could be corrupted or cause the model server to crash during loading or inference
  • Inference compute: service could become unavailable, disrupting all dependent AI pipelines and applications
  • Tools and systems the model is connected to: memory corruption could allow access to or modification of data passed to or from connected systems

Map where your company uses AI

Who is exposed

  • Teams running TensorFlow 2.2.0 through 2.2.0 (before 2.2.1) or 2.3.0 through 2.3.0 (before 2.3.1)
  • Services that load or process TensorFlow Lite models from external or user-provided sources
  • Applications that use segment sum operations with data not guaranteed to be sorted
  • Inference pipelines where segment IDs are generated from untrusted input at runtime

Upgrades you need

SoftwareAffected versionsMove to
tensorflow
PyPI
2.2.0 up to, but not including, 2.2.1; 2.3.0 up to, but not including, 2.3.12.3.1 or later
tensorflow-cpu
PyPI
2.2.0 up to, but not including, 2.2.1; 2.3.0 up to, but not including, 2.3.12.3.1 or later
tensorflow-gpu
PyPI
2.2.0 up to, but not including, 2.2.1; 2.3.0 up to, but not including, 2.3.12.3.1 or later

Each maintained branch has its own fixed version. Stay on your branch if you cannot jump to the newest: tensorflow 2.2.1, 2.3.1; tensorflow-cpu 2.2.1, 2.3.1; tensorflow-gpu 2.2.1, 2.3.1.

Am I affected?

Enter the version you run. Nothing you type is stored.

SecurityElites Developer Brief: the technical picture

Where the attacker must beAnywhere that can reach it over a network, including the internet if it is exposed
Account neededNone. No login is needed
Does a person have to do somethingNo. It works without anyone clicking or opening anything
How hard it is to doHard. It depends on conditions the attacker does not control
Risk of: data being readLimited
Risk of: data or settings being changedLimited
Risk of: the service being taken downHigh

Read from the official severity rating: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:L/A:H

Kind of coding mistake

  • CWE-787: memory is written out of bounds

If you cannot upgrade today

  • If you cannot upgrade immediately, add validation code to check that segment IDs are sorted in increasing order before they reach the segment sum operation. This works only if segment IDs are stored in the model or generated before inferenc
  • If segment IDs are generated as outputs during inference, there is no safe workaround. Upgrade as soon as possible.
  • Restrict access to model loading so that only trusted, pre-validated models are used, and avoid loading models from untrusted sources until you upgrade.

Signs it may already have been used against you

  • Segmentation faults or crash logs mentioning segment_sum or TensorFlow Lite operations, especially after model loading or inference
  • Memory corruption errors or unexpected memory access violations in TensorFlow processes
  • Crashes that occur when processing specific models or when segment IDs are provided in non-sorted order
  • Unexplained service restarts or process terminations during inference on TensorFlow Lite models

SecurityElites Fix Guide: step by step

  1. Find where TensorFlow is installedSearch your environment for TensorFlow package installations. Check Python environments with pip list | grep tensorflow, container images, and any virtual environments or conda environments used by your applications.
  2. Check the current versionNote the version number of tensorflow, tensorflow-cpu, or tensorflow-gpu that is installed in each location. Compare it against the affected versions: 2.2.0 through 2.2.0 (before 2.2.1) and 2.3.0 through 2.3.0 (before 2.3.1).
  3. Review use of segment sumSearch your code for uses of segment_sum operations or models that may contain this operation. If you accept models from external sources, note which ones could be affected.
  4. Back up current stateCreate a backup or snapshot of your current environment, deployed models, and configuration before making changes.
  5. Upgrade TensorFlowUpgrade tensorflow, tensorflow-cpu, or tensorflow-gpu to version 2.2.1 or 2.3.1 or later, depending on which version line you are on. Use your package manager (pip, conda, or container build process) to perform the upgrade.
  6. Restart servicesRestart all applications, services, or containers that use the upgraded TensorFlow package to ensure they load the new version.
  7. Verify the fix is in placeConfirm that the running application is using TensorFlow 2.2.1, 2.3.1, or later by checking the version in the running process or in log output at startup.
  8. Check for prior exploitationReview logs and monitoring data from before the upgrade for crashes, segmentation faults, or memory errors that may indicate this vulnerability was triggered. Look for unusual patterns in model loading or inference operations.

How to confirm it is fixed: Confirm that the installed TensorFlow version is 2.2.1 or later (if on the 2.2 line) or 2.3.1 or later (if on the 2.3 line) by running python -c 'import tensorflow; print(tensorflow.__version__)' in the production environment.

SecurityElites Quick Fixes: copy and paste

Upgrade tensorflow with pipupgrade

pip install --upgrade "tensorflow>=2.3.1"
pip show tensorflow | grep Version

Pin it in requirements.txtupgrade

tensorflow>=2.3.1

Upgrade tensorflow-cpu with pipupgrade

pip install --upgrade "tensorflow-cpu>=2.3.1"
pip show tensorflow-cpu | grep Version

Pin it in requirements.txtupgrade

tensorflow-cpu>=2.3.1

Upgrade tensorflow-gpu with pipupgrade

pip install --upgrade "tensorflow-gpu>=2.3.1"
pip show tensorflow-gpu | grep Version

Pin it in requirements.txtupgrade

tensorflow-gpu>=2.3.1

Check installed TensorFlow version in Pythonfor this issue

import tensorflow as tf
print(tf.__version__)

List TensorFlow packages in pipfor this issue

pip list | grep tensorflow

Test in a non-production environment first. General hardening examples use placeholder names and ports; change them to match your setup.

Let your AI coding assistant do the upgrade

Paste this into the coding assistant you already use, inside the project. It checks first and asks before it changes anything.

Instruction for your coding assistant

You are helping me fix a security vulnerability (CVE-2020-15214) in this project.\n\n1. Search the whole repository, including lock files, container files and CI configuration, for these packages and list every place they are pinned or installed:\n   - tensorflow (PyPI): must be 2.3.1 or later
   - tensorflow-cpu (PyPI): must be 2.3.1 or later
   - tensorflow-gpu (PyPI): must be 2.3.1 or later
2. Tell me which version we use now and whether it is affected. Stop and ask me before changing anything.
3. After I agree, raise each one to the safe version, update the lock files, and keep every other dependency as it is.
4. Run the tests and tell me what failed.
5. Give me a short summary of the files you changed that I can put in the pull request.

SecurityElites Incident Drill: could your team handle this?

Four questions to ask in your next team meeting. If any has no clear answer, that is the gap to close.

What versions of TensorFlow are affected by this vulnerability?A good answer: TensorFlow 2.2.0 (before 2.2.1) and 2.3.0 (before 2.3.1) are affected; versions 2.2.1, 2.3.1, and later are patched.
What can happen if an attacker provides a model with unsorted segment IDs to our service?A good answer: The service could crash with a segmentation fault, corrupt data in memory, or in some cases be exploited for further attacks depending on runtime conditions.
What is the fix for this vulnerability?A good answer: Upgrade TensorFlow to version 2.2.1 or 2.3.1 or later, which fixes the memory safety issue in segment sum operations.
If we cannot upgrade right now, what can we do to reduce the risk?A good answer: Validate that segment IDs are sorted before inference if they are stored in the model or generated before inference; if segment IDs are generated during inference, upgrade as soon as possible, and restrict model loading to trusted sources o

Run a full timed drill with your team

Ticket for your backlog

Paste into Jira, GitHub Issues or any tracker that reads Markdown.

Ready-made ticket

## TensorFlow segment sum can crash or corrupt memory if segment IDs are unsorted (CVE-2020-15214)

**Severity:** Critical  |  **SE Fix-First Score:** 51/100  |  **Fix window:** Within 7 days
**Record:** SE-AIV-00525 https://securityelites.com/ai-vulnerabilities/cve-2020-15214-tensorflow-segment-sum-can-crash-or-corrupt-memory-if/

### Why this matters
An attacker who can supply a TensorFlow Lite model or control the segment IDs passed to segment sum operations can crash the application or write to memory outside the intended bounds. This could lead to denial of service, data corruption, or in some cases enable further exploitation. Any service using TensorFlow Lite to process untrusted models or data is at risk.

### What to do
1. Find where TensorFlow is installed
2. Check the current version
3. Review use of segment sum
4. Back up current state
5. Upgrade TensorFlow
6. Restart services
7. Verify the fix is in place
8. Check for prior exploitation

Full steps: https://securityelites.com/ai-vulnerabilities/cve-2020-15214-tensorflow-segment-sum-can-crash-or-corrupt-memory-if/

### Done when
- [ ] tensorflow is at 2.3.1 or later everywhere it is installed
- [ ] tensorflow-cpu is at 2.3.1 or later everywhere it is installed
- [ ] tensorflow-gpu is at 2.3.1 or later everywhere it is installed
- [ ] Lock files, container images and CI configuration are updated
- [ ] Confirm that the installed TensorFlow version is 2.2.1 or later (if on the 2.2 line) or 2.3.1 or later (if on the 2.3 line) by running python -c 'import tensorflow; print(tensorflow.__version__)' in the production environment.
- [ ] Logs were checked for signs of earlier use

SecurityElites Fix Tracker

Record who owns this fix, the date it is due and when it is done, and see everything still open in one list. Free with a SecurityElites account.

Sign in to track this fix

Change history

  • 25 Sep 2020: Made public
  • 2 Dec 2026: Published

Official record

### Impact In TensorFlow Lite models using segment sum can trigger a write out bounds / segmentation fault if the segment ids are not sorted. Code assumes that the segment ids are in increasing order, using the last element of the tensor holding them to determine the dimensionality of output tensor: https://github.com/tensorflow/tensorflow/blob/0e68f4d3295eb0281a517c3662f6698992b7b2cf/tensorflow/lite/kernels/segment_sum.cc#L39-L44This results in allocating insufficient memory for the output tensor and in a write outside the bounds of the output array: https://github.com/tensorflow/tensorflow/blob/0e68f4d3295eb0281a517c3662f6698992b7b2cf/tensorflow/lite/kernels/internal/reference/reference_ops.h#L2625-L2631This usually results in a segmentation fault, but depending on runtime conditions it can provide for a write gadget to be used in future memory corruption-based exploits.### Patches We have patched the issue in 204945b and will release patch releases for all affected versions.We recommend users to upgrade to TensorFlow 2.2.1, or 2.3.1.### Workarounds A potential workaround would be to add a custom `Verifier` to the model loading code to ensure that the segment ids are sorted, although this only handles the case when the segment ids are stored statically in the model.A similar validation could be done if the segment ids are generated at runtime between inference steps.If the segment ids are generated as outputs of a tensor during inference steps, then there are no possible workaround and users are advised to upgrade to patched code.### For more information Please consult [our security guide](https://github.com/tensorflow/tensorflow/blob/master/SECURITY.md) for more information regarding the security model and how to contact us with issues and questions.### Attribution This vulnerability has been reported by members of the Aivul Team from Qihoo 360.

Weakness type: CWE-787

Use this record in your own tools

Get this record as JSON

curl https://securityelites.com/wp-json/se-aivd/v1/vulns/CVE-2020-15214

For scanners and pipelines: OSV format · CycloneDX format · API guide · Email alerts · Fix tracker

The plain-language sections were written with AI from the official record, and the upgrade versions come directly from the official data. Last updated 2 Dec 2026. Read the vendor advisory before changing a production system.