CVE-2020-15198: TensorFlow - SparseCountSparseOutput Shape Mismatch Vulnerability

tensorflow Updated 02 Oct 2025

Summary

25/09/2020
Yes i
Moderate
5.4

CVE-2020-15198: In Tensorflow before version 2.3.1, the SparseCountSparseOutput implementation does not validate that the input arguments form a valid sparse tensor. Affects tensorflow across 2 version ranges.

< 2.3.1 < 3cbb917b4714766030b28eba9fb41bb97ce9ee02

Fixed in 3cbb917b4714766030b28eba9fb41bb97ce9ee02. How to fix ↓

Also tracked for

The same CVE-2020-15198 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 is an open-source machine learning framework that provides a comprehensive ecosystem of tools, libraries, and community resources. It is widely used for building and deploying machine learning models. The SparseCountSparseOutput function in TensorFlow is responsible for counting the number of sparse elements in a tensor. However, prior to version 2.3.1, this implementation does not validate the shape of the input arguments, specifically the indices and values tensors. This lack of validation can lead to shape mismatches, resulting in out-of-bounds memory accesses.

Vulnerability Detail

The vulnerability (CVE-2020-15198) arises from the absence of shape validation in the SparseCountSparseOutput function of TensorFlow. When the indices tensor does not have the same shape as the values tensor, accessing the values in parallel can lead to accessing memory outside the bounds of allocated buffers. This can potentially result in memory corruption, crashes, or even remote code execution if exploited by an attacker. The issue has been addressed in commit 3cbb917b4714766030b28eba9fb41bb97ce9ee02 and released in TensorFlow version 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 version below is the minimum fixed release for this vulnerability.

If you need the minimum change

3cbb917b4714766030b28eba9fb41bb97ce9ee02

This is the first release that contains the fix.

pip install --upgrade "tensorflow==3cbb917b4714766030b28eba9fb41bb97ce9ee02"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There is no known workaround for this vulnerability. It is recommended to upgrade to the patched version of TensorFlow as soon as possible.

Conclusion

The SparseCountSparseOutput shape mismatch vulnerability in TensorFlow can have serious security implications, including memory corruption and potential remote code execution. It is crucial to upgrade to TensorFlow version 2.3.1 or later to mitigate this vulnerability. For further assistance or support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for tensorflow →

Share this vulnerability

FAQ

TensorFlow is an open-source machine learning framework widely used for building and deploying machine learning models.

The SparseCountSparseOutput function in TensorFlow is used to count the number of sparse elements in a tensor.

The vulnerability can lead to out-of-bounds memory accesses, potentially resulting in memory corruption, crashes, or remote code execution.

Yes, the vulnerability has been patched in TensorFlow version 2.3.1.

To fix this vulnerability, upgrade your TensorFlow installation to version 2.3.1 or later.

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 version below is the minimum fixed release for this vulnerability.

If you need the minimum change

3cbb917b4714766030b28eba9fb41bb97ce9ee02

This is the first release that contains the fix.

pip install --upgrade "tensorflow==3cbb917b4714766030b28eba9fb41bb97ce9ee02"

Tip — Not sure which version your app runs? Vulert can match this fix to it. 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