CVE-2020-15205: TensorFlow CPU - Heap Overflow and Memory Leak in StringNGrams
Summary
CVE-2020-15205: In Tensorflow before versions 1.15.4, 2.0.3, 2.1.2, 2.2.1 and 2.3.1, the data_splits argument of tf.raw_ops.StringNGrams lacks validation. Affects tensorflow-cpu across 6 version ranges.
< 1.15.4
>= 2.0.0, < 2.0.3
>= 2.1.0, < 2.1.2
>= 2.2.0, < 2.2.1
>= 2.3.0, < 2.3.1
< 0462de5b544ed4731aa2fb23946ac22c01856b80
Fixed in 5 releases; the minimum fixed version depends on the release line you run. How to fix ↓
Also tracked for
- tensorflow · Bitnami
- tensorflow · PyPI
- tensorflow-gpu · PyPI
- tensorflow · PyPI
The same CVE-2020-15205 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
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.
No signup required · Results in about 60 seconds
Background
TensorFlow is an open-source machine learning framework widely used for various tasks such as deep learning, neural networks, and natural language processing. It provides a comprehensive set of tools and libraries for building and deploying machine learning models. TensorFlow CPU is a specific package that focuses on running TensorFlow on CPUs rather than GPUs. This vulnerability affects versions of TensorFlow CPU before 1.15.4, 2.0.3, 2.1.2, 2.2.1, and 2.3.1.
Vulnerability Detail
The vulnerability in TensorFlow CPU lies in the data_splits argument of the tf.raw_ops.StringNGrams function. This argument lacks proper validation, allowing a user to pass values that can trigger heap overflow errors and potentially leak the contents of memory. An attacker could exploit this vulnerability to retrieve sensitive information from the memory stack, including return addresses, which can be used to bypass ASLR (Address Space Layout Randomization). The issue has been patched in commit 0462de5b544ed4731aa2fb23946ac22c01856b80 and is addressed in TensorFlow versions 1.15.4, 2.0.3, 2.1.2, 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-cpu==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.
-
< 1.15.41.15.4pip install --upgrade "tensorflow-cpu==1.15.4" -
>= 2.0.0, < 2.0.32.0.3pip install --upgrade "tensorflow-cpu==2.0.3" -
>= 2.1.0, < 2.1.22.1.2pip install --upgrade "tensorflow-cpu==2.1.2" -
>= 2.2.0, < 2.2.12.2.1pip install --upgrade "tensorflow-cpu==2.2.1" -
>= 2.3.0, < 2.3.12.3.1pip install --upgrade "tensorflow-cpu==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
As a temporary workaround, users can avoid using the tf.raw_ops.StringNGrams function or ensure that the data_splits argument is properly validated before passing any values. By implementing strict input validation, the risk of triggering heap overflow errors and memory leaks can be mitigated. Here is an example of how input validation can be performed:
import tensorflow as tf
def validate_data_splits(data_splits):
if isinstance(data_splits, str):
# Perform necessary validation checks
return True
else:
return False
# Usage example
if validate_data_splits(data_splits):
tf.raw_ops.StringNGrams(data_splits=data_splits)
Conclusion
The vulnerability in TensorFlow CPU versions before 1.15.4, 2.0.3, 2.1.2, 2.2.1, and 2.3.1 allows for heap overflow errors and memory leaks through the data_splits argument of the tf.raw_ops.StringNGrams function. This can potentially lead to the leakage of sensitive information and bypassing of ASLR. It is crucial to update TensorFlow CPU to one of the fixed versions or implement proper input validation to mitigate the risk. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow-cpu →
FAQ
TensorFlow CPU is a package that allows running TensorFlow on CPUs instead of GPUs. It provides optimized performance for CPU-based machine learning tasks.
tf.raw_ops.StringNGrams is a TensorFlow function that generates n-grams from a given input string. It is used for text processing and analysis tasks.
An attacker can exploit this vulnerability by passing malicious values to the data_splits argument of the tf.raw_ops.StringNGrams function. This can trigger heap overflow errors and potentially leak sensitive information from the memory stack.
The vulnerability can lead to heap overflow errors and memory leaks, which can be exploited to retrieve sensitive information from the memory stack. This information can include return addresses, allowing an attacker to bypass ASLR and potentially execute arbitrary code.
Yes, this vulnerability has been fixed in TensorFlow versions 1.15.4, 2.0.3, 2.1.2, 2.2.1, and 2.3.1. It is recommended to update to one of these versions to mitigate the risk.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow-cpu.