CVE-2020-15266: TensorFlow - Segmentation Fault in tf.image.crop_and_resize
Summary
CVE-2020-15266: Undefined behavior in Tensorflow. Affects tensorflow versions < 2.4.0. Fixed in 2.4.0. How to fix ↓
Also tracked for
- tensorflow · PyPI
- tensorflow · PyPI
- tensorflow-cpu · PyPI
- tensorflow-gpu · PyPI
The same CVE-2020-15266 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 developed by Google. It provides a comprehensive ecosystem of tools, libraries, and resources for building and deploying machine learning models. The tf.image.crop_and_resize function in TensorFlow is used to crop and resize images based on specified bounding boxes. This function is widely used in various computer vision tasks. However, prior to version 2.4.0, there was a vulnerability in the CPU kernel implementation of this function that could lead to a segmentation fault.
Vulnerability Detail
The vulnerability (CVE-2020-15266) arises when the boxes argument of tf.image.crop_and_resize is assigned a very large value. In such cases, the CPU kernel implementation interprets it as a C++ nan floating-point value. Attempting to operate on this undefined value results in a segmentation fault. An attacker could potentially exploit this vulnerability to crash the application or execute arbitrary code. The issue has been patched in TensorFlow version 2.4.0 and later.
How To Fix
Minimum fixed version
2.4.0
This is the first release that contains the fix.
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If upgrading to the latest version is not immediately feasible, a possible workaround is to ensure that the boxes argument of tf.image.crop_and_resize does not exceed the acceptable range. This can be achieved by validating and sanitizing the input values before passing them to the function. Here is an example of how to perform input validation in Python:
def crop_and_resize(image, boxes):
if max(boxes) > MAX_ALLOWED_VALUE:
raise ValueError('Invalid boxes argument')
# Perform the crop and resize operation
...
Conclusion
In conclusion, the vulnerability (CVE-2020-15266) in TensorFlow's tf.image.crop_and_resize function can lead to a segmentation fault when the boxes argument has a very large value. Upgrading to TensorFlow version 2.4.0 or later is recommended to fix this issue. If immediate upgrade is not feasible, validating and sanitizing the input values can serve as a temporary workaround. For further assistance and support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open-source machine learning framework developed by Google. It provides tools and resources for building and deploying machine learning models.
tf.image.crop_and_resize is a function in TensorFlow that is used to crop and resize images based on specified bounding boxes. It is commonly used in computer vision tasks.
The vulnerability can lead to a segmentation fault, potentially crashing the application or allowing an attacker to execute arbitrary code.
To fix this vulnerability, upgrade TensorFlow to version 2.4.0 or later.
If upgrading immediately is not possible, you can validate and sanitize the input values to ensure the boxes argument does not exceed the acceptable range.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.