Discover how CVE-2021-29587 exposes a division by zero flaw in TensorFlow's TFLite SpaceToDepth implementation. Learn about its impact, affected versions, and mitigation steps.
TensorFlow is an end-to-end open source platform for machine learning. The
Prepare
step of the SpaceToDepth
TFLite operator does not check for 0 before division. An attacker can craft a model to exploit this vulnerability. The fix is included in TensorFlow 2.5.0 and also backported to versions 2.4.2, 2.3.3, 2.2.3, and 2.1.4.
Understanding CVE-2021-29587
This CVE describes a vulnerability in TensorFlow that allows an attacker to trigger a division by zero in TFLite's implementation of the
SpaceToDepth
operator.
What is CVE-2021-29587?
The CVE-2021-29587 vulnerability in TensorFlow arises due to a missing check for zero before division in the
Prepare
step of the SpaceToDepth
TFLite operator. This can be exploited by attackers to craft malicious models.
The Impact of CVE-2021-29587
With a CVSS base score of 2.5 (Low severity), the vulnerability has a high attack complexity and requires low privileges. The attack vector is local, affecting confidentiality and integrity minimally.
Technical Details of CVE-2021-29587
The vulnerability allows attackers to trigger a division by zero in TensorFlow's TFLite
SpaceToDepth
implementation, potentially leading to denial of service or other security compromises.
Vulnerability Description
Attackers can exploit the vulnerable
SpaceToDepth
operator by crafting a model to set params->block_size
to zero, triggering a division by zero.
Affected Systems and Versions
The affected versions of TensorFlow include < 2.1.4, >= 2.2.0, < 2.2.3, >= 2.3.0, < 2.3.3, and >= 2.4.0, < 2.4.2.
Exploitation Mechanism
By manipulating the
params->block_size
value in a crafted model, an attacker can force the division by zero in the SpaceToDepth
TFLite operator.
Mitigation and Prevention
To mitigate CVE-2021-29587:
Immediate Steps to Take
Update TensorFlow to versions where the fix is included (2.5.0 or backported versions).
Long-Term Security Practices
Regularly update TensorFlow to the latest versions and stay informed about security advisories.
Patching and Updates
Apply patches provided by TensorFlow to address the vulnerability and ensure the software is up-to-date.