CVE-2021-32040

published 12 Apr 2022 · updated 16 Sep 2024

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

6.5MediumCVSS 6.5EPSS 2%

No exploitation in the wild has been reported. EPSS puts the chance of exploitation in the next 30 days at 2%. Fixed in Server 4.2.16 and Server 5.0.4.

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

Vendors, products and packages with version ranges

VendorProductVersionsFixed
MongoDBServer>=4.2 <4.2.16, >=4.4 <=4.4.28, >=5.0 <5.0.44.2.16, 5.0.4

Timeline

Every event on this vulnerability

Related

Other vulnerabilities in MongoDB, strongest first

Embed

A live severity badge for an advisory, README or ticket

CVE-2021-32040 severity on Zeptric[![CVE-2021-32040](https://zeptric.io/badge/cve/CVE-2021-32040.svg)](https://zeptric.io/cve/CVE-2021-32040)