Miggo Logo

CVE-2021-37685: Heap OOB in TFLite

5.5

CVSS Score
3.1

Basic Information

EPSS Score
0.02138%
Published
8/25/2021
Updated
11/13/2024
KEV Status
No
Technology
TechnologyPython

Technical Details

CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
tensorflowpip< 2.3.42.3.4
tensorflowpip>= 2.4.0, < 2.4.32.4.3
tensorflowpip= 2.5.02.5.1
tensorflow-cpupip< 2.3.42.3.4
tensorflow-cpupip>= 2.4.0, < 2.4.32.4.3
tensorflow-cpupip= 2.5.02.5.1
tensorflow-gpupip< 2.3.42.3.4
tensorflow-gpupip>= 2.4.0, < 2.4.32.4.3
tensorflow-gpupip= 2.5.02.5.1

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot 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.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

### Imp**t T*Lit*'s [`*xp*n*_*ims.**`](*ttps://*it*u*.*om/t*nsor*low/t*nsor*low/*lo*/****************************************/t*nsor*low/lit*/k*rn*ls/*xp*n*_*ims.**#L**-L**) *ont*ins * vuln*r**ility w*i** *llows r***in* on* *l*m*nt outsi** o* *oun*s

Reasoning

T** vuln*r**ility st*ms *rom insu**i*i*nt v*li**tion o* t** `*xis` p*r*m*t*r in `*xp*n*T*nsor*im`. T** *o** **justs n***tiv* `*xis` v*lu*s *y ***in* `input_*ims.siz* + *`, *ut *o*s not *nsur* t** r*sult is non-n***tiv*. T** su*s*qu*nt loop ****ss*s `