CVE-2021-29587: TensorFlow - SpaceToDepth TFLite Operator Division by Zero Vulnerability
Summary
CVE-2021-29587: Division by zero in TFLite's implementation of SpaceToDepth. Affects tensorflow across 4 version ranges.
< 2.1.4
>= 2.2.0, < 2.2.3
>= 2.3.0, < 2.3.3
>= 2.4.0, < 2.4.2
Fixed in 4 releases; the minimum fixed version depends on the release line you run. How to fix ↓
Also tracked for
- tensorflow · PyPI
- tensorflow · PyPI
- tensorflow-cpu · PyPI
- tensorflow-gpu · PyPI
The same CVE-2021-29587 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 end-to-end open source platform for machine learning. It provides a comprehensive ecosystem for building and deploying machine learning models. The SpaceToDepth TFLite operator is used to rearrange data by spatially partitioning it into blocks and then concatenating them. This operator is vulnerable to a division by zero issue in the Prepare step, which can be exploited by an attacker.
Vulnerability Detail
The Prepare step of the SpaceToDepth TFLite operator in TensorFlow does not check for a zero value before performing division. This can be exploited by an attacker by crafting a malicious model where the params->block_size parameter is set to zero. As a result, a division by zero error occurs during the execution of the operator. This vulnerability can lead to various consequences, including denial of service (DoS) attacks, data corruption, and potential code execution.
How To Fix
Fixed versions by release line
The minimum fixed version depends on the release line you run.
-
< 2.1.42.1.4 -
>= 2.2.0, < 2.2.32.2.3 -
>= 2.3.0, < 2.3.32.3.3 -
>= 2.4.0, < 2.4.22.4.2
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
There is no specific workaround mentioned for this vulnerability. Users are advised to follow the recommended fix and upgrade to the patched versions of TensorFlow.
Conclusion
The SpaceToDepth TFLite operator in TensorFlow is vulnerable to a division by zero issue, which can be exploited by an attacker. To mitigate this vulnerability, users should upgrade their TensorFlow installations to the patched versions or follow the recommended fix. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for tensorflow →
FAQ
TensorFlow is an open source platform for machine learning that provides a comprehensive ecosystem for building and deploying machine learning models.
The SpaceToDepth TFLite operator is used to rearrange data by spatially partitioning it into blocks and then concatenating them.
This vulnerability can lead to denial of service (DoS) attacks, data corruption, and potential code execution.
To fix this vulnerability, upgrade your TensorFlow installation to version 2.5.0 or later. Alternatively, you can upgrade to the patched versions for earlier supported versions.
There is no specific workaround mentioned for this vulnerability. It is recommended to follow the fix and upgrade to the patched versions.
References
Related vulnerabilities
Recent vulnerabilities recorded for tensorflow.