{
    "containers": {
        "cna": {
            "affected": [
                {
                    "defaultStatus": "unaffected",
                    "product": "MongoDB Server",
                    "vendor": "MongoDB Inc.",
                    "versions": [
                        {
                            "lessThan": "5.0.4",
                            "status": "affected",
                            "version": "5.0",
                            "versionType": "custom"
                        },
                        {
                            "lessThanOrEqual": "4.4.28",
                            "status": "affected",
                            "version": "4.4",
                            "versionType": "custom"
                        },
                        {
                            "lessThan": "4.2.16",
                            "status": "affected",
                            "version": "4.2",
                            "versionType": "custom"
                        }
                    ]
                }
            ],
            "datePublic": "2022-04-11T23:00:00.000Z",
            "descriptions": [
                {
                    "lang": "en",
                    "supportingMedia": [
                        {
                            "base64": false,
                            "type": "text/html",
                            "value": "<p>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 <span style=\"background-color: rgb(255, 255, 255);\">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.</span></p><p><span style=\"background-color: rgb(255, 255, 255);\">Workaround:&nbsp;&gt;= 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.</span></p>"
                        }
                    ],
                    "value": "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."
                }
            ],
            "metrics": [
                {
                    "cvssV3_1": {
                        "attackComplexity": "LOW",
                        "attackVector": "NETWORK",
                        "availabilityImpact": "HIGH",
                        "baseScore": 6.5,
                        "baseSeverity": "MEDIUM",
                        "confidentialityImpact": "NONE",
                        "integrityImpact": "NONE",
                        "privilegesRequired": "LOW",
                        "scope": "UNCHANGED",
                        "userInteraction": "NONE",
                        "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H",
                        "version": "3.1"
                    },
                    "format": "CVSS",
                    "scenarios": [
                        {
                            "lang": "en",
                            "value": "GENERAL"
                        }
                    ]
                }
            ],
            "problemTypes": [
                {
                    "descriptions": [
                        {
                            "cweId": "CWE-121",
                            "description": "CWE-121 Stack-based Buffer Overflow",
                            "lang": "en",
                            "type": "CWE"
                        }
                    ]
                }
            ],
            "providerMetadata": {
                "orgId": "a39b4221-9bd0-4244-95fc-f3e2e07f1deb",
                "shortName": "mongodb",
                "dateUpdated": "2024-02-23T16:04:43.143Z"
            },
            "references": [
                {
                    "tags": [
                        "x_refsource_MISC"
                    ],
                    "url": "https://jira.mongodb.org/browse/SERVER-58203"
                },
                {
                    "tags": [
                        "x_refsource_MISC"
                    ],
                    "url": "https://jira.mongodb.org/browse/SERVER-59299"
                },
                {
                    "tags": [
                        "x_refsource_MISC"
                    ],
                    "url": "https://jira.mongodb.org/browse/SERVER-60218"
                },
                {
                    "tags": [
                        "x_refsource_CONFIRM"
                    ],
                    "url": "https://security.netapp.com/advisory/ntap-20220609-0005/"
                }
            ],
            "source": {
                "discovery": "EXTERNAL"
            },
            "title": "Large aggregation pipelines with a specific stage can crash mongod under default configuration",
            "workarounds": [
                {
                    "lang": "en",
                    "supportingMedia": [
                        {
                            "base64": false,
                            "type": "text/html",
                            "value": "&gt;= 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."
                        }
                    ],
                    "value": ">= 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."
                }
            ],
            "x_generator": {
                "engine": "Vulnogram 0.0.9"
            },
            "x_legacyV4Record": {
                "CVE_data_meta": {
                    "ASSIGNER": "cna@mongodb.com",
                    "DATE_PUBLIC": "2022-04-12T20:00:00.000Z",
                    "ID": "CVE-2021-32040",
                    "STATE": "PUBLIC",
                    "TITLE": "Large aggregation pipelines with a specific stage can crash mongod under default configuration"
                },
                "affects": {
                    "vendor": {
                        "vendor_data": [
                            {
                                "product": {
                                    "product_data": [
                                        {
                                            "product_name": "MongoDB Server",
                                            "version": {
                                                "version_data": [
                                                    {
                                                        "version_affected": "<",
                                                        "version_name": "5.0",
                                                        "version_value": "5.0.4"
                                                    },
                                                    {
                                                        "version_affected": "<",
                                                        "version_name": "4.4",
                                                        "version_value": "4.4.11"
                                                    },
                                                    {
                                                        "version_affected": "<",
                                                        "version_name": "4.2",
                                                        "version_value": "4.2.16"
                                                    }
                                                ]
                                            }
                                        }
                                    ]
                                },
                                "vendor_name": "MongoDB Inc."
                            }
                        ]
                    }
                },
                "data_format": "MITRE",
                "data_type": "CVE",
                "data_version": "4.0",
                "description": {
                    "description_data": [
                        {
                            "lang": "eng",
                            "value": "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 versions prior to 5.0.4, 4.4.11, 4.2.16."
                        }
                    ]
                },
                "generator": {
                    "engine": "Vulnogram 0.0.9"
                },
                "impact": {
                    "cvss": {
                        "attackComplexity": "LOW",
                        "attackVector": "NETWORK",
                        "availabilityImpact": "HIGH",
                        "baseScore": 6.5,
                        "baseSeverity": "MEDIUM",
                        "confidentialityImpact": "NONE",
                        "integrityImpact": "NONE",
                        "privilegesRequired": "LOW",
                        "scope": "UNCHANGED",
                        "userInteraction": "NONE",
                        "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H",
                        "version": "3.1"
                    }
                },
                "problemtype": {
                    "problemtype_data": [
                        {
                            "description": [
                                {
                                    "lang": "eng",
                                    "value": "CWE-121 Stack-based Buffer Overflow"
                                }
                            ]
                        }
                    ]
                },
                "references": {
                    "reference_data": [
                        {
                            "name": "https://jira.mongodb.org/browse/SERVER-58203",
                            "refsource": "MISC",
                            "url": "https://jira.mongodb.org/browse/SERVER-58203"
                        },
                        {
                            "name": "https://jira.mongodb.org/browse/SERVER-59299",
                            "refsource": "MISC",
                            "url": "https://jira.mongodb.org/browse/SERVER-59299"
                        },
                        {
                            "name": "https://jira.mongodb.org/browse/SERVER-60218",
                            "refsource": "MISC",
                            "url": "https://jira.mongodb.org/browse/SERVER-60218"
                        },
                        {
                            "name": "https://security.netapp.com/advisory/ntap-20220609-0005/",
                            "refsource": "CONFIRM",
                            "url": "https://security.netapp.com/advisory/ntap-20220609-0005/"
                        }
                    ]
                },
                "source": {
                    "discovery": "EXTERNAL"
                },
                "work_around": [
                    {
                        "lang": "en",
                        "value": ">=4.2.16 users can add the --setParameter internalPipelineLengthLimit=50 instead of the default 1000 to mongod at startup to prevent a crash."
                    }
                ]
            }
        },
        "adp": [
            {
                "providerMetadata": {
                    "orgId": "af854a3a-2127-422b-91ae-364da2661108",
                    "shortName": "CVE",
                    "dateUpdated": "2024-08-03T23:17:29.135Z"
                },
                "title": "CVE Program Container",
                "references": [
                    {
                        "tags": [
                            "x_refsource_MISC",
                            "x_transferred"
                        ],
                        "url": "https://jira.mongodb.org/browse/SERVER-58203"
                    },
                    {
                        "tags": [
                            "x_refsource_MISC",
                            "x_transferred"
                        ],
                        "url": "https://jira.mongodb.org/browse/SERVER-59299"
                    },
                    {
                        "tags": [
                            "x_refsource_MISC",
                            "x_transferred"
                        ],
                        "url": "https://jira.mongodb.org/browse/SERVER-60218"
                    },
                    {
                        "tags": [
                            "x_refsource_CONFIRM",
                            "x_transferred"
                        ],
                        "url": "https://security.netapp.com/advisory/ntap-20220609-0005/"
                    }
                ]
            },
            {
                "affected": [
                    {
                        "vendor": "mongodb",
                        "product": "mongodb",
                        "cpes": [
                            "cpe:2.3:a:mongodb:mongodb:*:*:*:*:*:*:*:*"
                        ],
                        "defaultStatus": "unknown",
                        "versions": [
                            {
                                "version": "5.0",
                                "status": "affected",
                                "lessThan": "5.0.4",
                                "versionType": "custom"
                            },
                            {
                                "version": "4.4",
                                "status": "affected",
                                "lessThanOrEqual": "4.4.28",
                                "versionType": "custom"
                            },
                            {
                                "version": "4.2",
                                "status": "affected",
                                "lessThan": "4.2.16",
                                "versionType": "custom"
                            }
                        ]
                    }
                ],
                "metrics": [
                    {
                        "other": {
                            "type": "ssvc",
                            "content": {
                                "timestamp": "2024-02-23T18:16:37.734248Z",
                                "id": "CVE-2021-32040",
                                "options": [
                                    {
                                        "Exploitation": "none"
                                    },
                                    {
                                        "Automatable": "no"
                                    },
                                    {
                                        "Technical Impact": "partial"
                                    }
                                ],
                                "role": "CISA Coordinator",
                                "version": "2.0.3"
                            }
                        }
                    }
                ],
                "title": "CISA ADP Vulnrichment",
                "providerMetadata": {
                    "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
                    "shortName": "CISA-ADP",
                    "dateUpdated": "2024-08-15T17:07:34.494Z"
                }
            }
        ]
    },
    "cveMetadata": {
        "assignerOrgId": "a39b4221-9bd0-4244-95fc-f3e2e07f1deb",
        "assignerShortName": "mongodb",
        "cveId": "CVE-2021-32040",
        "datePublished": "2022-04-12T14:15:16.692284Z",
        "dateReserved": "2021-05-05T00:00:00",
        "dateUpdated": "2024-09-16T20:03:21.667Z",
        "state": "PUBLISHED"
    },
    "dataType": "CVE_RECORD",
    "dataVersion": "5.1"
}