{"id":"CVE-2021-32040","url":"https://www.cyber-defence.io/tools/cve/CVE-2021-32040","generatedAt":"2026-10-28T06:48:46.296Z","title":"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.","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.\n\nWorkaround: >= 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.","published":"2022-04-12T15:15:08.000Z","lastModified":"2026-06-17T03:52:43.000Z","status":"Modified","sourceIdentifier":"cna@mongodb.com","cvss":{"version":"3.1","score":7.5,"severity":"HIGH","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"},"cwe":["CWE-121","CWE-787"],"affected":["mongodb/mongodb"],"epss":{"score":0.02011,"percentile":0.80764,"date":"2026-10-27","history":[]},"kev":{"listed":false},"exploits":{"count":0,"verified":false,"firstPublished":null,"source":"Exploit-DB (https://gitlab.com/exploit-database/exploitdb)","entries":[]},"verdict":{"level":"high","text":"High impact if exploited, but EPSS currently rates exploitation as unlikely (2.01%). Schedule it in the normal patch cycle and watch for a rise in EPSS or a public exploit."},"changes":[],"references":[{"url":"https://jira.mongodb.org/browse/SERVER-58203","tags":["Issue Tracking","Patch","Vendor Advisory"],"source":"cna@mongodb.com"},{"url":"https://jira.mongodb.org/browse/SERVER-59299","tags":["Issue Tracking","Patch","Vendor Advisory"],"source":"cna@mongodb.com"},{"url":"https://jira.mongodb.org/browse/SERVER-60218","tags":["Issue Tracking","Patch","Vendor Advisory"],"source":"cna@mongodb.com"},{"url":"https://security.netapp.com/advisory/ntap-20220609-0005/","tags":["Third Party Advisory"],"source":"cna@mongodb.com"},{"url":"https://jira.mongodb.org/browse/SERVER-58203","tags":["Issue Tracking","Patch","Vendor Advisory"],"source":"af854a3a-2127-422b-91ae-364da2661108"},{"url":"https://jira.mongodb.org/browse/SERVER-59299","tags":["Issue Tracking","Patch","Vendor Advisory"],"source":"af854a3a-2127-422b-91ae-364da2661108"},{"url":"https://jira.mongodb.org/browse/SERVER-60218","tags":["Issue Tracking","Patch","Vendor Advisory"],"source":"af854a3a-2127-422b-91ae-364da2661108"},{"url":"https://security.netapp.com/advisory/ntap-20220609-0005/","tags":["Third Party Advisory"],"source":"af854a3a-2127-422b-91ae-364da2661108"}],"sources":{"nvd":"https://nvd.nist.gov/vuln/detail/CVE-2021-32040","epss":"https://www.first.org/epss/","kev":"https://www.cisa.gov/known-exploited-vulnerabilities-catalog","exploitdb":"https://www.exploit-db.com/"},"licence":"CC BY 4.0 — link back to the CVE Explorer if you publish the results; upstream data remains subject to its own terms."}