TensorFlow segment sum can write outside heap memory bounds
What this means
An attacker who can supply input data to a TensorFlow Lite model using segment sum operations can write to memory outside the intended buffer. This can crash the application, corrupt other data in memory, or be combined with other flaws to take control of the system.
SecurityElites Manager Brief: the decision in one minute
TensorFlow versions 2.2.0, 2.2.1-dev, 2.3.0, and 2.3.0-dev have a critical memory safety flaw in segment sum operations that allows writing past buffer boundaries. Any team running these versions on untrusted input must upgrade immediately.
| SecurityElites Fix-First Score | 51 of 100 Our own ranking of what to fix first. Real attacks count most, then the chance of attack, then severity. |
|---|---|
| SecurityElites fix window | Within 7 days Critical severity. This is our suggestion from common practice; your own policy comes first. |
| Who should own the fix | Machine learning or ML ops team, with coordination from infrastructure and security. |
| Likely effort | About 30 minutes per deployment: identify which services use affected TensorFlow versions, upgrade to the patched version, and restart. Mapping all TensorFlow uses across your infrastructure may take longer. |
Questions to ask your team or supplier
- Which services and models in our infrastructure currently use TensorFlow 2.2.0, 2.3.0, or development versions of 2.2.1 or 2.3.1?
- Do any of our models accept untrusted segment_ids, or can segment_ids be derived from user input or external data sources?
- Do we have tests or monitoring in place to verify that model inference fails safely (rather than corrupting memory silently) if invalid input is supplied?
Message you can forward to the owning team
Security notice: TensorFlow segment sum can write outside heap memory bounds (CVE-2020-15212)
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-15212-tensorflow-segment-sum-can-write-outside-heap-memory-bounds/
Source: SecurityElites AI Vulnerabilities Database, record SE-AIV-00480What is at stake in your AI setup
- Model files: corruption or crash of the inference engine could prevent models from loading or running.
- Inference serving infrastructure: memory corruption could compromise the host system and other workloads or models running on the same hardware.
- Compute resources: crashes may cause retry loops and waste GPU/CPU cycles and billing.
Who is exposed
- Teams running TensorFlow 2.2.0 through 2.3.0 that load or infer from TensorFlow Lite models with segment sum layers.
- Services that accept user-supplied model files or accept input data for inference on user-provided models.
- Production pipelines using these versions for real-time or batch inference.
- Development and testing environments if they use the same vulnerable versions.
Upgrades you need
| Software | Affected versions | Move to |
|---|---|---|
| tensorflow PyPI | 2.2.0 up to, but not including, 2.2.1; 2.3.0 up to, but not including, 2.3.1 | 2.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.1 | 2.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.1 | 2.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 be | Anywhere that can reach it over a network, including the internet if it is exposed |
|---|---|
| Account needed | None. No login is needed |
| Does a person have to do something | No. It works without anyone clicking or opening anything |
| How hard it is to do | Hard. It depends on conditions the attacker does not control |
| Risk of: data being read | Limited |
| Risk of: data or settings being changed | Limited |
| Risk of: the service being taken down | High |
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
- Add a custom validator when loading TensorFlow Lite models to check that all segment_ids in the model are non-negative. This protects only models with static segment_ids; it does not help if segment_ids are generated at runtime.
- If segment_ids are generated at runtime between inference steps, add a validation step to ensure all values are non-negative before calling inference.
- If segment_ids are generated as outputs during inference (dynamic generation inside the model graph), there is no workaround: upgrade to the patched version.
Signs it may already have been used against you
- Segmentation faults or crash dumps in services running affected TensorFlow versions, especially those that load or infer from Lite models. Check system logs (syslog, dmesg) and application error logs.
- Unusual memory access patterns or memory corruption errors in TensorFlow inference code paths in crash reports or error logs.
- Unexpected termination of model serving processes or batch jobs with no clear application error message.
- If models accept user-supplied segment_ids or segment_ids are derived from user input, look for attempts to supply negative values in those tensors in application logs or input audit trails.
SecurityElites Fix Guide: step by step
- Find where TensorFlow is installedCheck all Python environments where TensorFlow runs: use `pip list | grep tensorflow` in each virtualenv, conda environment, and container. Record the version and whether it is `tensorflow`, `tensorflow-cpu`, or `tensorflow-gpu`.
- Identify models using segment sumSearch your model files for segment sum operations. For TensorFlow Lite models, you can inspect the model metadata or check your model definitions and training code. If you are unsure whether a model uses segment sum, treat it as if it does until verified.
- Check if untrusted data reaches segment sum layersTrace the data flow: does input data, model weights, or the segment_ids tensor come from outside your controlled environment (users, APIs, external files, model downloads)? If segment_ids are static in the model and never change, the risk is lower but still present if the model itself is untrusted.
- Upgrade TensorFlow to patched versionFor TensorFlow 2.2.x, upgrade to 2.2.1 or later. For TensorFlow 2.3.x, upgrade to 2.3.1 or later. Use `pip install --upgrade tensorflow==2.2.1` or `tensorflow==2.3.1` (or `tensorflow-cpu` / `tensorflow-gpu` as appropriate) and verify the upgrade in the same Python environment.
- Restart affected servicesStop and restart all services that import or use TensorFlow, including model servers, batch inference jobs, and API endpoints. Verify they come back up and are healthy.
- Confirm the patched version is runningIn each Python environment, run `python -c 'import tensorflow; print(tensorflow.__version__)'` and confirm the version is 2.2.1 or later (for 2.2.x) or 2.3.1 or later (for 2.3.x).
- Review and add input validation if neededIf segment_ids are generated at runtime from user input or external data, add validation to ensure all values are non-negative before inference. This is an additional safety layer but does not replace the upgrade.
- Check logs for signs of past exploitationReview application error logs, system logs, and crash dumps from before the upgrade date for segmentation faults or memory corruption events that may indicate this flaw was triggered. Escalate any findings to your security team.
How to confirm it is fixed: Run `python -c 'import tensorflow; print(tensorflow.__version__)'` in the Python environment and confirm the version is 2.2.1 or later (if upgrading from 2.2.x) or 2.3.1 or later (if upgrading from 2.3.x).
SecurityElites Quick Fixes: copy and paste
Upgrade tensorflow with pipupgrade
pip install --upgrade "tensorflow>=2.3.1"
pip show tensorflow | grep VersionPin it in requirements.txtupgrade
tensorflow>=2.3.1Upgrade tensorflow-cpu with pipupgrade
pip install --upgrade "tensorflow-cpu>=2.3.1"
pip show tensorflow-cpu | grep VersionPin it in requirements.txtupgrade
tensorflow-cpu>=2.3.1Upgrade tensorflow-gpu with pipupgrade
pip install --upgrade "tensorflow-gpu>=2.3.1"
pip show tensorflow-gpu | grep VersionPin it in requirements.txtupgrade
tensorflow-gpu>=2.3.1Check installed TensorFlow version in Pythonfor this issue
python -c 'import tensorflow; print(f"TensorFlow {tensorflow.__version__}")';Validate segment_ids are non-negative before inferencefor this issue
import numpy as np
import tensorflow as tf
segment_ids = ... # your segment_ids tensor
if np.any(segment_ids < 0):
raise ValueError('Segment IDs must be non-negative')
# safe to call inferenceTest 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-15212) 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.
Ticket for your backlog
Paste into Jira, GitHub Issues or any tracker that reads Markdown.
Ready-made ticket
## TensorFlow segment sum can write outside heap memory bounds (CVE-2020-15212)
**Severity:** Critical | **SE Fix-First Score:** 51/100 | **Fix window:** Within 7 days
**Record:** SE-AIV-00480 https://securityelites.com/ai-vulnerabilities/cve-2020-15212-tensorflow-segment-sum-can-write-outside-heap-memory-bounds/
### Why this matters
An attacker who can supply input data to a TensorFlow Lite model using segment sum operations can write to memory outside the intended buffer. This can crash the application, corrupt other data in memory, or be combined with other flaws to take control of the system.
### What to do
1. Find where TensorFlow is installed
2. Identify models using segment sum
3. Check if untrusted data reaches segment sum layers
4. Upgrade TensorFlow to patched version
5. Restart affected services
6. Confirm the patched version is running
7. Review and add input validation if needed
8. Check logs for signs of past exploitation
Full steps: https://securityelites.com/ai-vulnerabilities/cve-2020-15212-tensorflow-segment-sum-can-write-outside-heap-memory-bounds/
### 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
- [ ] Run `python -c 'import tensorflow; print(tensorflow.__version__)'` in the Python environment and confirm the version is 2.2.1 or later (if upgrading from 2.2.x) or 2.3.1 or later (if upgrading from 2.3.x).
- [ ] 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.
Related vulnerabilities
In the same software
- TensorFlow can crash or run attacker code when given out-of-bounds axis Critical · CVE-2023-25668
- TensorFlow boosted trees can crash or allow memory access outside bounds Critical · GHSA-h6gw-r52c-724r
- TensorFlow boosted trees can crash or allow heap memory read/write Critical · CVE-2021-41208
- TensorFlow segment sum can crash or corrupt memory if segment IDs are unsorted Critical · CVE-2020-15214
- TensorFlow can read memory outside its bounds from a malicious checkpoint file Critical · CVE-2018-7575
The same kind of mistake in other AI tools
- jncraton languagemodels can run attacker code via model templates High · CVE-2026-139989
- DeepSeek-AI DeepGEMM can write data outside memory bounds in attention code High · CVE-2026-139817
- NLTK can run untrusted dot command from writable directory High · CVE-2026-128134
- rmcp OAuth resource parameter not validated, allowing token theft High · CVE-2026-63127
- n8n workflow expressions can run code with full server access High · CVE-2026-65591
Change history
- 25 Sep 2020: Made public
- 2 Dec 2026: Published
Official record
### Impact In TensorFlow Lite models using segment sum can trigger writes outside of bounds of heap allocated buffers by inserting negative elements in the segment ids tensor: https://github.com/tensorflow/tensorflow/blob/0e68f4d3295eb0281a517c3662f6698992b7b2cf/tensorflow/lite/kernels/internal/reference/reference_ops.h#L2625-L2631Users having access to `segment_ids_data` can alter `output_index` and then write to outside of `output_data` buffer.This might result in a segmentation fault but it can also be used to further corrupt the memory and can be chained with other vulnerabilities to create more advanced 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 all positive, 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 discovered from a variant analysis of [GHSA-p2cq-cprg-frvm](https://github.com/tensorflow/tensorflow/security/advisories/GHSA-p2cq-cprg-frvm).
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-15212For 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.