Miggo Logo

CVE-2021-29564: Null pointer dereference in `EditDistance`

2.5

CVSS Score
3.1

Basic Information

EPSS Score
0.01803%
Published
5/21/2021
Updated
11/1/2024
KEV Status
No
Technology
TechnologyPython

Technical Details

CVSS Vector
CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:N/I:N/A:L
Package NameEcosystemVulnerable VersionsFirst Patched Version
tensorflowpip< 2.1.42.1.4
tensorflowpip>= 2.2.0, < 2.2.32.2.3
tensorflowpip>= 2.3.0, < 2.3.32.3.3
tensorflowpip>= 2.4.0, < 2.4.22.4.2
tensorflow-cpupip< 2.1.42.1.4
tensorflow-cpupip>= 2.2.0, < 2.2.32.2.3
tensorflow-cpupip>= 2.3.0, < 2.3.32.3.3
tensorflow-cpupip>= 2.4.0, < 2.4.22.4.2
tensorflow-gpupip< 2.1.42.1.4
tensorflow-gpupip>= 2.2.0, < 2.2.32.2.3
tensorflow-gpupip>= 2.3.0, < 2.3.32.3.3
tensorflow-gpupip>= 2.4.0, < 2.4.22.4.2

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from the EditDistanceOp's Compute function allocating an output tensor based on output_shape without validating it has >0 elements. The patch adds an explicit check (OP_REQUIRES(ctx, output_elements > 0)) to prevent empty allocations. The original code's lack of this check directly leads to the null dereference when operating on an empty buffer via setZero(). The function's responsibility for buffer allocation and initialization makes it the clear vulnerable entry point.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

### Imp**t *n *tt**k*r **n tri***r * null point*r **r***r*n** in t** impl*m*nt*tion o* `t*.r*w_ops.**it*ist*n**`: ```pyt*on import t*nsor*low *s t* *ypot**sis_in*i**s = t*.*onst*nt([***, ***, ***], s**p*=[*, *], *typ*=t*.int**) *ypot**sis_v*lu

Reasoning

T** vuln*r**ility st*ms *rom t** **it*ist*n**Op's *omput* *un*tion *llo**tin* *n output t*nsor **s** on output_s**p* wit*out v*li**tin* it **s >* *l*m*nts. T** p*t** ***s *n *xpli*it ****k (OP_R*QUIR*S(*tx, output_*l*m*nts > *)) to pr*v*nt *mpty *llo