Vulnerability · Published Apr 12, 2022 · Assigned by mongodb

CVE-2021-32040Large aggregation pipelines with a specific stage can crash mongod under default configuration

Medium 6.5

In plain English

A medium-severity stack buffer overflow in MongoDB Server from MongoDB Inc.. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 2.0% (higher than 81% of all known vulnerabilities).

Severity (CVSS 3.1)6.5Medium
Exploit odds (30 days)2.0%top 19.0% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack toolingNoneno public tooling known

Official 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 products (as reported)

VendorProductVersions
MongoDB Inc. MongoDB Server 5.0 – before 5.0.44.4 – through 4.4.284.2 – before 4.2.16

Weakness: CWE-121 · Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H

References