CVE-2021-32040
published medium CVSS 3.1 · 6.5Large aggregation pipelines with a specific stage can crash mongod under default configuration
Package status and fixes
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| MongoDB Inc. | — | MongoDB Server5.0 to < 5.0.4 · 4.4 through 4.4.28 · 4.2 to < 4.2.16 · Other versions: unaffected | Affected | Not stated | mongodb |
| mongodb | — | mongodb5.0 to < 5.0.4 · 4.4 through 4.4.28 · 4.2 to < 4.2.16 · Other versions: unknown | Affected | Not stated | CISA-ADP |
Description
It may be possible to have an extremely long aggregation pipeline in conjunction with a specific stage/operator and cause a stack overflow due to the size of the stack frames used by that stage. If an attacker could cause such an aggregation to occur, they could maliciously crash MongoDB in a DoS attack. This vulnerability affects MongoDB Server v4.4 versions prior to and including 4.4.28, MongoDB Server v5.0 versions prior to 5.0.4 and MongoDB Server v4.2 versions prior to 4.2.16. Workaround: >= v4.2.16 users and all v4.4 users can add the --setParameter internalPipelineLengthLimit=50 instead of the default 1000 to mongod at startup to prevent a crash.
Related advisories
Vendor advisories explicitly linked to this CVE.
No linked advisories were found for this CVE.
Assessment
CVSS risk assessment and additional context for this vulnerability.
- CVSS version
- 3.1
- Base score
- 6.5 / 10
- Severity
- medium
- Provider
- mongodb · cna
- Vector string
- CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
- Scenarios
- en: GENERAL
Publisher product statements
Version ranges and default statuses as reported by each provider.
| Vendor | Product | Version status | Source |
|---|---|---|---|
| MongoDB Inc. | MongoDB Server | 5.0 to < 5.0.4 (affected · custom)4.4 through 4.4.28 (affected · custom)4.2 to < 4.2.16 (affected · custom)Default: unaffected | mongodb · cna |
| mongodb | mongodb | 5.0 to < 5.0.4 (affected · custom)4.4 through 4.4.28 (affected · custom)4.2 to < 4.2.16 (affected · custom)Default: unknown | CISA-ADP · adp |
Weaknesses
1- CWE-121 CWE-121 Stack-based Buffer Overflow
References
4Provider assertions
3mongodb · cna
Large aggregation pipelines with a specific stage can crash mongod under default configuration
CISA-ADP · adp
CISA ADP Vulnrichment
CVE · adp
CVE Program Container
Provenance
- Schema
- 5.1
- Searchable
- yes
- Content hash
- f6604268d698fb61ded6e09d14d48f0a8c136878d5069f9925ae21d3c1238c7f
- Ingested
- 23 Sep 2026, 07:54:21 UTC
- Source record
- Official CVE record