CVE-2020-26267: TensorFlow - Uninitialized Memory Access and Crashes in tf.raw_ops.DataFormatVecPermute
Summary
CVE-2020-26267: In affected versions of TensorFlow the tf.raw_ops.DataFormatVecPermute API does not validate the src_format and dst_format attributes. Affects tensorflow across 6 version ranges.
< 1.15.5
>= 2.0.0, < 2.0.4
>= 2.1.0, < 2.1.3
>= 2.2.0, < 2.2.2
>= 2.3.0, < 2.3.2
< ebc70b7a592420d3d2f359e4b1694c236b82c7ae
Fixed in 5 releases; the minimum fixed version depends on the release line you run. How to fix ↓
Also tracked for
- tensorflow · Bitnami
- tensorflow-cpu · PyPI
- tensorflow-gpu · PyPI
The same CVE-2020-26267 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 developing and training deep learning models. It provides a comprehensive ecosystem of tools, libraries, and resources for building and deploying machine learning applications. The tf.raw_ops.DataFormatVecPermute API in TensorFlow is responsible for permuting data formats, specifically assuming a permutation of NHWC (Number of examples, Height, Width, Channels).
Vulnerability Detail
In affected versions of TensorFlow, the tf.raw_ops.DataFormatVecPermute API does not properly validate the src_format and dst_format attributes. The code assumes that these two arguments define a permutation of NHWC, which can lead to uninitialized memory accesses, reading outside of bounds, and even crashes. An attacker could potentially exploit this vulnerability to execute arbitrary code or cause denial of service. This vulnerability is tracked as CVE-2020-26267 and has been assigned the identifier GHSA-c9f3-9wfr-wgh7.
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.
-
< 1.15.51.15.5pip install --upgrade "tensorflow==1.15.5" -
>= 2.0.0, < 2.0.42.0.4pip install --upgrade "tensorflow==2.0.4" -
>= 2.1.0, < 2.1.32.1.3pip install --upgrade "tensorflow==2.1.3" -
>= 2.2.0, < 2.2.22.2.2pip install --upgrade "tensorflow==2.2.2" -
>= 2.3.0, < 2.3.22.3.2pip install --upgrade "tensorflow==2.3.2"
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 workaround, if updating TensorFlow is not immediately feasible, developers can manually validate the src_format and dst_format attributes before using the tf.raw_ops.DataFormatVecPermute API. This can be done by ensuring that the provided formats are valid permutations of NHWC. Here's an example code snippet in Python:
import tensorflow as tf
def validate_formats(src_format, dst_format):
valid_formats = ['NHWC', 'NCHW', 'HWCN', 'HWNC', ...] # List of valid permutations
if src_format not in valid_formats or dst_format not in valid_formats:
raise ValueError('Invalid format permutation')
# Usage
src_format = 'NHWC'
dst_format = 'NCHW'
validate_formats(src_format, dst_format)
Conclusion
In conclusion, the tf.raw_ops.DataFormatVecPermute API in TensorFlow is vulnerable to uninitialized memory accesses, reading outside of bounds, and crashes. It is crucial to update TensorFlow to the fixed versions or manually validate the format attributes to mitigate this vulnerability. For further support on vulnerability remediation, you can reach out to DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open-source machine learning framework used for developing and training deep learning models. It provides a comprehensive ecosystem of tools, libraries, and resources for building and deploying machine learning applications.
The tf.raw_ops.DataFormatVecPermute API in TensorFlow is responsible for permuting data formats, specifically assuming a permutation of NHWC (Number of examples, Height, Width, Channels).
This vulnerability can result in uninitialized memory accesses, reading outside of bounds, and crashes. It could potentially be exploited by an attacker to execute arbitrary code or cause denial of service.
To fix this vulnerability, update TensorFlow to one of the fixed versions: 1.15.5, 2.0.4, 2.1.3, 2.2.2, 2.3.2, or 2.4.0. These versions include the necessary validation for the tf.raw_ops.DataFormatVecPermute API.
Yes, if updating TensorFlow is not immediately feasible, you can manually validate the src_format and dst_format attributes before using the tf.raw_ops.DataFormatVecPermute API. Ensure that the provided formats are valid permutations of NHWC.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.