CVE-2021-37685: Heap OOB in TFLite
5.5
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.02138%
CWE
Published
8/25/2021
Updated
11/13/2024
KEV Status
No
Technology
Python
Technical Details
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
tensorflow | pip | < 2.3.4 | 2.3.4 |
tensorflow | pip | >= 2.4.0, < 2.4.3 | 2.4.3 |
tensorflow | pip | = 2.5.0 | 2.5.1 |
tensorflow-cpu | pip | < 2.3.4 | 2.3.4 |
tensorflow-cpu | pip | >= 2.4.0, < 2.4.3 | 2.4.3 |
tensorflow-cpu | pip | = 2.5.0 | 2.5.1 |
tensorflow-gpu | pip | < 2.3.4 | 2.3.4 |
tensorflow-gpu | pip | >= 2.4.0, < 2.4.3 | 2.4.3 |
tensorflow-gpu | pip | = 2.5.0 | 2.5.1 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from insufficient validation of the axis
parameter in ExpandTensorDim
. The code adjusts negative axis
values by adding input_dims.size + 1
, but does not ensure the result is non-negative. The subsequent loop accesses input_dims.data[i - 1]
when i > axis
, which becomes input_dims.data[-1]
when axis
is negative. The patch adds TF_LITE_ENSURE(context, axis >= 0)
, confirming this was the root cause. The function's direct manipulation of array indices and the fix's location in the code confirm the vulnerability.