{"id":"CVE-2021-32040","aliases":["BIT-mongodb-2021-32040","UBUNTU-CVE-2021-32040"],"summary":"Large aggregation pipelines with a specific stage can crash mongod under default configuration","published_at":"2022-04-12T00:00:00Z","modified_at":"2026-09-08T08:48:13.870609Z","products":[{"slug":"rhel","name":"Red Hat Enterprise Linux","category":"red-hat"}],"rating":{"severity":"high","score":7.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","attack_path":"internet_unauthenticated","user_interaction":false,"malicious":false,"red_hat":"Moderate","vendor_ratings":[{"source":"Ubuntu","rating":"medium"},{"source":"Red Hat","rating":"Moderate"}]},"fix_available":false,"kev":{"listed":false,"ransomware":false},"public_exploit":false,"exploits":[],"epss":{"score":0.020109999924898148,"percentile":0.812969982624054,"date":"2026-11-19T00:00:00Z"},"priority":9.5,"details":"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.","affected_stack":[{"ecosystem":"Red Hat:rhui:3","package":"mongodb","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"provider":"redhat-vex","source":"CVE-2021-32040","relation":"self"}],"affected_other":[{"ecosystem":"Bitnami","package":"mongodb","purl":"pkg:bitnami/mongodb","ranges":[{"type":"SEMVER","events":[{"introduced":"4.2.0"},{"fixed":"4.2.16"},{"introduced":"4.4.0"},{"fixed":"4.4.11"},{"introduced":"5.0.0"},{"fixed":"5.0.4"}]}],"fixed":["4.2.16","4.4.11","5.0.4"],"provider":"osv","source":"BIT-mongodb-2021-32040","relation":"self"},{"ecosystem":"CVE","package":"MongoDB Inc./MongoDB Server","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"5.0"},{"fixed":"5.0.4"}]},{"type":"ECOSYSTEM","events":[{"introduced":"4.4"},{"last_affected":"4.4.28"}]},{"type":"ECOSYSTEM","events":[{"introduced":"4.2"},{"fixed":"4.2.16"}]}],"fixed":["5.0.4","4.2.16"],"provider":"cvelistv5","source":"CVE-2021-32040","relation":"self"},{"ecosystem":"NVD","package":"mongodb:mongodb","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"4.2.0"},{"fixed":"4.2.16"}]},{"type":"ECOSYSTEM","events":[{"introduced":"4.4.0"},{"fixed":"4.4.11"}]},{"type":"ECOSYSTEM","events":[{"introduced":"5.0.0"},{"fixed":"5.0.4"}]}],"fixed":["4.2.16","4.4.11","5.0.4"],"provider":"nvd","source":"CVE-2021-32040","relation":"self"},{"ecosystem":"Ubuntu:Pro:14.04:LTS","package":"mongodb","purl":"pkg:deb/ubuntu/mongodb@1:2.4.9-1ubuntu2+esm2?arch=source&distro=esm-infra-legacy/trusty","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["1:2.4.6-0ubuntu5","1:2.4.6-0ubuntu6","1:2.4.8-1ubuntu1","1:2.4.8-2","1:2.4.9-1","1:2.4.9-1ubuntu1","1:2.4.9-1ubuntu2","1:2.4.9-1ubuntu2+esm2"],"provider":"osv","source":"UBUNTU-CVE-2021-32040","relation":"self"},{"ecosystem":"Ubuntu:Pro:16.04:LTS","package":"mongodb","purl":"pkg:deb/ubuntu/mongodb@1:2.6.10-0ubuntu1+esm2?arch=source&distro=esm-apps/xenial","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["1:2.6.10-0ubuntu1","1:2.6.10-0ubuntu1+esm2"],"provider":"osv","source":"UBUNTU-CVE-2021-32040","relation":"self"},{"ecosystem":"Ubuntu:Pro:18.04:LTS","package":"mongodb","purl":"pkg:deb/ubuntu/mongodb@1:3.6.3-0ubuntu1.4+esm2?arch=source&distro=esm-apps/bionic","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["1:3.4.7-1","1:3.4.7-1ubuntu1","1:3.4.7-1ubuntu2","1:3.4.7-1ubuntu4","1:3.4.14-3ubuntu1","1:3.4.14-3ubuntu2","1:3.6.3-0ubuntu1","1:3.6.3-0ubuntu1.1","1:3.6.3-0ubuntu1.3","1:3.6.3-0ubuntu1.4","1:3.6.3-0ubuntu1.4+esm1","1:3.6.3-0ubuntu1.4+esm2"],"provider":"osv","source":"UBUNTU-CVE-2021-32040","relation":"self"},{"ecosystem":"Ubuntu:Pro:20.04:LTS","package":"mongodb","purl":"pkg:deb/ubuntu/mongodb@1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5.3+esm1?arch=source&distro=esm-apps/focal","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu2","1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5","1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5.2","1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5.3","1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5.3+esm1"],"provider":"osv","source":"UBUNTU-CVE-2021-32040","relation":"self"}],"product_status":[{"vendor":"Red Hat","product":"Red Hat Openshift Data Foundation 4","cpe":"cpe:/a:redhat:openshift_data_foundation:4","status":"affected","packages":["noobaa-core-container","odf4/mcg-core-rhel9"],"package_count":2,"fixed":[],"advisories":[],"note":"Out of support scope","provider":"redhat-vex","source":"CVE-2021-32040"},{"vendor":"Red Hat","product":"Red Hat Satellite 6","cpe":"cpe:/a:redhat:satellite:6","status":"not_affected","packages":["libmongodb","mongodb","mongodb-server"],"package_count":3,"fixed":[],"advisories":[],"note":"vulnerable_code_not_present","provider":"redhat-vex","source":"CVE-2021-32040"},{"vendor":"Red Hat","product":"Red Hat Update Infrastructure 3 for Cloud Providers","cpe":"cpe:/a:redhat:rhui:3","status":"affected","packages":["mongodb"],"package_count":1,"fixed":[],"advisories":[],"note":"Will not fix","provider":"redhat-vex","source":"CVE-2021-32040"}],"records":[{"provider":"cvelistv5","source_id":"CVE-2021-32040","relation":"self","url":"https://www.cve.org/CVERecord?id=CVE-2021-32040","license":"CC-BY-4.0","published_at":"2022-04-12T14:15:16.692Z","modified_at":"2024-09-16T20:03:21.667Z","summary":"Large aggregation pipelines with a specific stage can crash mongod under default configuration","details":"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.","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","source":"CVE-2021-32040"}],"affected":[{"ecosystem":"CVE","package":"MongoDB Inc./MongoDB Server","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"5.0"},{"fixed":"5.0.4"}]},{"type":"ECOSYSTEM","events":[{"introduced":"4.4"},{"last_affected":"4.4.28"}]},{"type":"ECOSYSTEM","events":[{"introduced":"4.2"},{"fixed":"4.2.16"}]}],"fixed":["5.0.4","4.2.16"],"provider":"cvelistv5","source":"CVE-2021-32040","relation":"self"}],"product_status":[],"references":[{"type":"WEB","url":"https://jira.mongodb.org/browse/SERVER-58203"},{"type":"WEB","url":"https://jira.mongodb.org/browse/SERVER-59299"},{"type":"WEB","url":"https://jira.mongodb.org/browse/SERVER-60218"},{"type":"WEB","url":"https://security.netapp.com/advisory/ntap-20220609-0005/"}]},{"provider":"nvd","source_id":"CVE-2021-32040","relation":"self","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-32040","severity":[],"affected":[{"ecosystem":"NVD","package":"mongodb:mongodb","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"4.2.0"},{"fixed":"4.2.16"}]},{"type":"ECOSYSTEM","events":[{"introduced":"4.4.0"},{"fixed":"4.4.11"}]},{"type":"ECOSYSTEM","events":[{"introduced":"5.0.0"},{"fixed":"5.0.4"}]}],"fixed":["4.2.16","4.4.11","5.0.4"],"provider":"nvd","source":"CVE-2021-32040","relation":"self"}],"product_status":[],"references":[]},{"provider":"osv","source_id":"BIT-mongodb-2021-32040","relation":"self","url":"https://osv.dev/vulnerability/BIT-mongodb-2021-32040","license":"Apache-2.0","published_at":"2024-03-06T10:57:09.971Z","modified_at":"2026-09-08T08:48:13.870609Z","summary":"Large aggregation pipelines with a specific stage can crash mongod under default configuration","details":"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.","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","source":"BIT-mongodb-2021-32040"}],"affected":[{"ecosystem":"Bitnami","package":"mongodb","purl":"pkg:bitnami/mongodb","ranges":[{"type":"SEMVER","events":[{"introduced":"4.2.0"},{"fixed":"4.2.16"},{"introduced":"4.4.0"},{"fixed":"4.4.11"},{"introduced":"5.0.0"},{"fixed":"5.0.4"}]}],"fixed":["4.2.16","4.4.11","5.0.4"],"provider":"osv","source":"BIT-mongodb-2021-32040","relation":"self"}],"product_status":[],"references":[{"type":"ADVISORY","url":"https://jira.mongodb.org/browse/SERVER-58203"},{"type":"ADVISORY","url":"https://jira.mongodb.org/browse/SERVER-59299"},{"type":"ADVISORY","url":"https://jira.mongodb.org/browse/SERVER-60218"},{"type":"ADVISORY","url":"https://security.netapp.com/advisory/ntap-20220609-0005/"},{"type":"WEB","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-32040"}]},{"provider":"osv","source_id":"UBUNTU-CVE-2021-32040","relation":"self","url":"https://osv.dev/vulnerability/UBUNTU-CVE-2021-32040","license":"CC-BY-SA-4.0","published_at":"2022-04-12T15:15:00Z","modified_at":"2026-04-22T12:50:48.888044Z","details":"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.","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","source":"UBUNTU-CVE-2021-32040"},{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","source":"UBUNTU-CVE-2021-32040"},{"type":"Ubuntu","score":"medium","source":"UBUNTU-CVE-2021-32040"}],"affected":[{"ecosystem":"Ubuntu:Pro:14.04:LTS","package":"mongodb","purl":"pkg:deb/ubuntu/mongodb@1:2.4.9-1ubuntu2+esm2?arch=source&distro=esm-infra-legacy/trusty","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["1:2.4.6-0ubuntu5","1:2.4.6-0ubuntu6","1:2.4.8-1ubuntu1","1:2.4.8-2","1:2.4.9-1","1:2.4.9-1ubuntu1","1:2.4.9-1ubuntu2","1:2.4.9-1ubuntu2+esm2"],"provider":"osv","source":"UBUNTU-CVE-2021-32040","relation":"self"},{"ecosystem":"Ubuntu:Pro:16.04:LTS","package":"mongodb","purl":"pkg:deb/ubuntu/mongodb@1:2.6.10-0ubuntu1+esm2?arch=source&distro=esm-apps/xenial","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["1:2.6.10-0ubuntu1","1:2.6.10-0ubuntu1+esm2"],"provider":"osv","source":"UBUNTU-CVE-2021-32040","relation":"self"},{"ecosystem":"Ubuntu:Pro:18.04:LTS","package":"mongodb","purl":"pkg:deb/ubuntu/mongodb@1:3.6.3-0ubuntu1.4+esm2?arch=source&distro=esm-apps/bionic","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["1:3.4.7-1","1:3.4.7-1ubuntu1","1:3.4.7-1ubuntu2","1:3.4.7-1ubuntu4","1:3.4.14-3ubuntu1","1:3.4.14-3ubuntu2","1:3.6.3-0ubuntu1","1:3.6.3-0ubuntu1.1","1:3.6.3-0ubuntu1.3","1:3.6.3-0ubuntu1.4","1:3.6.3-0ubuntu1.4+esm1","1:3.6.3-0ubuntu1.4+esm2"],"provider":"osv","source":"UBUNTU-CVE-2021-32040","relation":"self"},{"ecosystem":"Ubuntu:Pro:20.04:LTS","package":"mongodb","purl":"pkg:deb/ubuntu/mongodb@1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5.3+esm1?arch=source&distro=esm-apps/focal","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"versions":["1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu2","1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5","1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5.2","1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5.3","1:3.6.9+really3.6.8+90~g8e540c0b6d-0ubuntu5.3+esm1"],"provider":"osv","source":"UBUNTU-CVE-2021-32040","relation":"self"}],"product_status":[],"references":[{"type":"REPORT","url":"https://ubuntu.com/security/CVE-2021-32040"},{"type":"REPORT","url":"https://jira.mongodb.org/browse/SERVER-58203"},{"type":"REPORT","url":"https://jira.mongodb.org/browse/SERVER-59299"},{"type":"REPORT","url":"https://jira.mongodb.org/browse/SERVER-60218"},{"type":"REPORT","url":"https://www.cve.org/CVERecord?id=CVE-2021-32040"}]},{"provider":"redhat-vex","source_id":"CVE-2021-32040","relation":"self","url":"https://access.redhat.com/security/cve/CVE-2021-32040","license":"CC-BY-4.0","published_at":"2022-04-12T00:00:00Z","modified_at":"2023-07-07T08:31:45Z","summary":"mongodb: Pipeline Stack-based Overflow","details":"A flaw was found in MongoDB. This flaw allows an attacker to maliciously crash MongoDB in a denial of service attack if they can cause an extremely long aggregation pipeline in conjunction with a specific stage/operator, which leads to a stack overflow due to the size of the stack frames used by that stage.","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","source":"CVE-2021-32040"},{"type":"Red Hat","score":"Moderate","source":"CVE-2021-32040"}],"affected":[{"ecosystem":"Red Hat:rhui:3","package":"mongodb","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"provider":"redhat-vex","source":"CVE-2021-32040","relation":"self"}],"product_status":[{"vendor":"Red Hat","product":"Red Hat Openshift Data Foundation 4","cpe":"cpe:/a:redhat:openshift_data_foundation:4","status":"affected","packages":["noobaa-core-container","odf4/mcg-core-rhel9"],"package_count":2,"fixed":[],"advisories":[],"note":"Out of support scope","provider":"redhat-vex","source":"CVE-2021-32040"},{"vendor":"Red Hat","product":"Red Hat Satellite 6","cpe":"cpe:/a:redhat:satellite:6","status":"not_affected","packages":["libmongodb","mongodb","mongodb-server"],"package_count":3,"fixed":[],"advisories":[],"note":"vulnerable_code_not_present","provider":"redhat-vex","source":"CVE-2021-32040"},{"vendor":"Red Hat","product":"Red Hat Update Infrastructure 3 for Cloud Providers","cpe":"cpe:/a:redhat:rhui:3","status":"affected","packages":["mongodb"],"package_count":1,"fixed":[],"advisories":[],"note":"Will not fix","provider":"redhat-vex","source":"CVE-2021-32040"}],"references":[{"type":"WEB","url":"https://security.access.redhat.com/data/csaf/v2/vex/2021/cve-2021-32040.json"},{"type":"WEB","url":"https://access.redhat.com/security/cve/CVE-2021-32040"},{"type":"WEB","url":"https://bugzilla.redhat.com/show_bug.cgi?id=2074792"},{"type":"WEB","url":"https://www.cve.org/CVERecord?id=CVE-2021-32040"},{"type":"WEB","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-32040"}]}],"references":[{"type":"WEB","url":"https://jira.mongodb.org/browse/SERVER-58203"},{"type":"WEB","url":"https://jira.mongodb.org/browse/SERVER-59299"},{"type":"WEB","url":"https://jira.mongodb.org/browse/SERVER-60218"},{"type":"WEB","url":"https://security.netapp.com/advisory/ntap-20220609-0005/"},{"type":"WEB","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-32040"},{"type":"REPORT","url":"https://ubuntu.com/security/CVE-2021-32040"},{"type":"REPORT","url":"https://www.cve.org/CVERecord?id=CVE-2021-32040"},{"type":"WEB","url":"https://security.access.redhat.com/data/csaf/v2/vex/2021/cve-2021-32040.json"},{"type":"WEB","url":"https://access.redhat.com/security/cve/CVE-2021-32040"},{"type":"WEB","url":"https://bugzilla.redhat.com/show_bug.cgi?id=2074792"}],"sources":[{"provider":"cvelistv5","source_id":"CVE-2021-32040","url":"https://www.cve.org/CVERecord?id=CVE-2021-32040","license":"CC-BY-4.0","modified_at":"2024-09-16T20:03:21.667Z","relation":"self"},{"provider":"nvd","source_id":"CVE-2021-32040","url":"https://nvd.nist.gov/vuln/detail/CVE-2021-32040","relation":"self"},{"provider":"osv","source_id":"BIT-mongodb-2021-32040","url":"https://osv.dev/vulnerability/BIT-mongodb-2021-32040","license":"Apache-2.0","modified_at":"2026-09-08T08:48:13.870609Z","relation":"self"},{"provider":"osv","source_id":"UBUNTU-CVE-2021-32040","url":"https://osv.dev/vulnerability/UBUNTU-CVE-2021-32040","license":"CC-BY-SA-4.0","modified_at":"2026-04-22T12:50:48.888044Z","relation":"self"},{"provider":"redhat-vex","source_id":"CVE-2021-32040","url":"https://access.redhat.com/security/cve/CVE-2021-32040","license":"CC-BY-4.0","modified_at":"2023-07-07T08:31:45Z","relation":"self"}]}
