CVE-2021-32040

Large aggregation pipelines with a specific stage can crash mongod under default configuration

HIGH
7.5
CVSS Score
Published: April 12, 2022 at 02:15 PM UTC
Updated: June 17, 2026 at 03:52 AM UTC
1 product affected across 1 vendorMongoDB

Using MongoDB Server by MongoDB Inc.?

Get instant alerts when new vulnerabilities affect MongoDB Server - before attackers find them.

Real-time alertsTrack your software stackFree plan available
Severity
HIGH7.5
Exploit prediction
EPSS 2%
SSVC
No known exploit

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.

Affected

Our own answer: ranges merged, affected separated from platform-only, with confidence and review flags.

4.2 ≤ v < 4.2.164.2.0 ≤ v < 4.2.164.4 ≤ v ≤ 4.4.284.4.0 ≤ v < 4.4.115.0 ≤ v < 5.0.45.0.0 ≤ v < 5.0.44.24.45.0
Affected range stops below 4.2.16, so it looks safe — our inference, not a vendor statement
Affected range stops below 4.4.11, so it looks safe — our inference, not a vendor statement
Affected range stops below 5.0.4, so it looks safe — our inference, not a vendor statement

Remediation

No guide yet

No remediation guidance has been written for this CVE yet. What the record does show:

References (4)

x_refsource_MISCIssue TrackingPatchVendor Advisory
https://jira.mongodb.org/browse/SERVER-58203
x_refsource_MISCIssue TrackingPatchVendor Advisory
https://jira.mongodb.org/browse/SERVER-59299
x_refsource_MISCIssue TrackingPatchVendor Advisory
https://jira.mongodb.org/browse/SERVER-60218

SSVC — Action Prioritization

SSVCNo known exploitNot automatablePartial impact

SSVC signals action urgency (what to patch first), separate from CVSS which measures severity.

CVSS

Attack Vector
NETWORK
Complexity
LOW
Privileges
NONE
User Interaction
NONE
Scope
UNCHANGED
Confidentiality
NONE
Integrity
NONE
Availability
HIGH
Vector?

Quick Info

StatusMODIFIED
CWE
CWE-121CWE-787

Get alerted

Stop reading CVE feeds looking for your own stack

Track the products you run and VulnTracker tells you when a new CVE affects them — with what is known about fixing it, and nothing about the rest.

Free plan, no card