Miggo Logo

CVE-2021-20329: go.mongodb.org/mongo-driver improperly validates cstrings when marshalling Go objects into BSON

6.8

CVSS Score
3.1

Basic Information

EPSS Score
0.33492%
Published
6/15/2021
Updated
9/17/2024
KEV Status
No
Technology
TechnologyGo

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
go.mongodb.org/mongo-drivergo< 1.5.11.5.1

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The commit 2aca31d5986a9e1c65a92264736de9fdc3b9b4ca introduces validation checks for null bytes in BSON key names and regex fields, addressing CVE-2021-20329. The functions modified in this commit (WriteRegex, writeElementHeader, AppendHeader, AppendRegex) are directly involved in processing user-provided data during BSON marshalling. The added checks indicate that these functions previously lacked proper input validation, allowing attackers to inject null bytes and manipulate the resulting BSON structure. These functions would appear in stack traces or runtime profiles when processing malicious payloads, as they are entry points for BSON serialization where the vulnerability could be triggered.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

Sp**i*i* *strin*s input m*y not ** prop*rly v*li**t** in t** Mon*o** *o *riv*r w**n m*rs**llin* *o o*j**ts into *SON. * m*li*ious us*r *oul* us* * *o o*j**t wit* sp**i*i* strin* to pot*nti*lly inj**t ***ition*l *i*l*s into m*rs**ll** *o*um*nts. T*is

Reasoning

T** *ommit **************************************** intro*u**s v*li**tion ****ks *or null *yt*s in *SON k*y n*m*s *n* r***x *i*l*s, ***r*ssin* *V*-****-*****. T** *un*tions mo*i*i** in t*is *ommit (`Writ*R***x`, `writ**l*m*nt*****r`, `*pp*n******r`,