CVE-2020-15212: TensorFlow Lite Negative Element Insertion Vulnerability

tensorflow Updated 02 Oct 2025

Summary

25/09/2020
Yes i
Critical
8.1

CVE-2020-15212: In TensorFlow Lite before versions 2.2.1 and 2.3.1, models using segment sum can trigger writes outside of bounds of heap allocated buffers by inserting negative elements in the segment ids tensor. Affects tensorflow across 3 version ranges.

>= 2.2.0, < 2.2.1 >= 2.3.0, < 2.3.1 < 204945b19e44b57906c9344c0d00120eeeae178a

Fixed in 2.2.1 or 2.3.1, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2020-15212 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

TensorFlow Lite is an open-source deep learning framework designed for mobile and embedded devices. It allows developers to deploy machine learning models on resource-constrained platforms. TensorFlow Lite provides efficient inference for a wide range of models, including those used in image recognition, natural language processing, and more. However, versions before 2.2.1 and 2.3.1 are vulnerable to a negative element insertion issue in the segment sum functionality.

Vulnerability Detail

The vulnerability in TensorFlow Lite arises from the segment sum functionality, which can be exploited by inserting negative elements in the segment ids tensor. This manipulation allows an attacker with access to segment_ids_data to alter output_index and write outside the bounds of the output_data buffer. While this may result in a segmentation fault, it can also be leveraged to corrupt memory and potentially chain with other vulnerabilities for more advanced exploits. The issue has been patched in commit 204945b19e44b57906c9344c0d00120eeeae178a and is released in TensorFlow versions 2.2.1 and 2.3.1.

How To Fix

Latest published version: 2.21.0 as of 22 Oct 2026

pip install --upgrade "tensorflow==2.21.0"

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • >= 2.2.0, < 2.2.1 2.2.1
    pip install --upgrade "tensorflow==2.2.1"
  • >= 2.3.0, < 2.3.1 2.3.1
    pip install --upgrade "tensorflow==2.3.1"

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

A potential workaround for this vulnerability is to add a custom Verifier to the model loading code. This Verifier should ensure that all segment ids are positive, effectively preventing the insertion of negative elements. However, this workaround only applies when the segment ids are stored statically in the model. If the segment ids are generated at runtime between inference steps, there is no possible workaround, and upgrading to the patched code is the recommended solution.

Conclusion

The negative element insertion vulnerability in TensorFlow Lite can be exploited to write outside the bounds of heap allocated buffers, potentially leading to memory corruption and advanced exploits. Users should upgrade to TensorFlow Lite versions 2.2.1 or 2.3.1, which contain the necessary patch. For further support on vulnerability remediation, contact DevNack.com.

See every vulnerability recorded for tensorflow →

Share this vulnerability

FAQ

TensorFlow Lite is an open-source deep learning framework designed for mobile and embedded devices. It allows developers to deploy machine learning models on resource-constrained platforms.

Versions before 2.2.1 and 2.3.1 of TensorFlow Lite are vulnerable to this negative element insertion issue in the segment sum functionality.

By inserting negative elements in the segment ids tensor, an attacker can write outside the bounds of the heap allocated buffers. This can lead to a segmentation fault or be used to corrupt memory, potentially enabling more advanced exploits.

To fix this vulnerability, upgrade your TensorFlow Lite installation to version 2.2.1 or 2.3.1, which include the necessary patch. This can be done by updating the package using the package manager or manually installing the updated version from the TensorFlow repository.

A potential workaround is to add a custom Verifier to the model loading code, ensuring that all segment ids are positive. However, this workaround only applies when the segment ids are stored statically in the model. If the segment ids are generated at runtime between inference steps, there is no possible workaround, and upgrading to the patched code is recommended.

Related vulnerabilities

Recent vulnerabilities recorded for tensorflow.

How To Fix

Latest published version: 2.21.0 as of 22 Oct 2026

pip install --upgrade "tensorflow==2.21.0"

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • >= 2.2.0, < 2.2.1 2.2.1
    pip install --upgrade "tensorflow==2.2.1"
  • >= 2.3.0, < 2.3.1 2.3.1
    pip install --upgrade "tensorflow==2.3.1"

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback