CVE-2021-29593: Division by zero in TFLite's implementation of `BatchToSpaceNd`
2.5
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.0254%
CWE
Published
5/21/2021
Updated
10/31/2024
KEV Status
No
Technology
Python
Technical Details
CVSS Vector
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
tensorflow | pip | < 2.1.4 | 2.1.4 |
tensorflow | pip | >= 2.2.0, < 2.2.3 | 2.2.3 |
tensorflow | pip | >= 2.3.0, < 2.3.3 | 2.3.3 |
tensorflow | pip | >= 2.4.0, < 2.4.2 | 2.4.2 |
tensorflow-cpu | pip | < 2.1.4 | 2.1.4 |
tensorflow-cpu | pip | >= 2.2.0, < 2.2.3 | 2.2.3 |
tensorflow-cpu | pip | >= 2.3.0, < 2.3.3 | 2.3.3 |
tensorflow-cpu | pip | >= 2.4.0, < 2.4.2 | 2.4.2 |
tensorflow-gpu | pip | < 2.1.4 | 2.1.4 |
tensorflow-gpu | pip | >= 2.2.0, < 2.2.3 | 2.2.3 |
tensorflow-gpu | pip | >= 2.3.0, < 2.3.3 | 2.3.3 |
tensorflow-gpu | pip | >= 2.4.0, < 2.4.2 | 2.4.2 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems directly from lines 81-82 in batch_to_space_nd.cc, which are part of the ResizeOutputTensor function. The code checks if output_batch_size is divisible by block_shape[dim] (TF_LITE_ENSURE_EQ) but does not validate that block_shape[dim] itself is non-zero first. The patch adds a TF_LITE_ENSURE check for block_shape[dim] != 0, confirming this was the vulnerable location. The function's role in processing attacker-controlled block_shape inputs and performing division makes it the clear vulnerability source.