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
CVE ID
GHSA ID
EPSS Score
0.33492%
CWE
Published
6/15/2021
Updated
9/17/2024
KEV Status
No
Technology
Go
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:N
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
go.mongodb.org/mongo-driver | go | < 1.5.1 | 1.5.1 |
Vulnerability Intelligence
Miggo AI
Root 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.