VYPR
Unrated severityNVD Advisory· Published Apr 12, 2022· Updated Sep 16, 2024

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

CVE-2021-32040

Description

A stack overflow in MongoDB's aggregation pipeline allows remote attackers to cause a denial of service via a crafted query.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

A stack overflow in MongoDB's aggregation pipeline allows remote attackers to cause a denial of service via a crafted query.

Vulnerability

A stack overflow vulnerability exists in MongoDB's aggregation pipeline when a specific stage or operator is used in conjunction with an extremely long pipeline. The large stack frames consumed by that stage cause a stack overflow, leading to a crash. This affects MongoDB Server v4.4 versions prior to and including 4.4.28, v5.0 versions prior to 5.0.4, and v4.2 versions prior to 4.2.16. [1]

Exploitation

An attacker with network access to the MongoDB server can send a crafted aggregation query containing an extremely long pipeline with the vulnerable stage or operator. No authentication is required if the server is configured to allow unauthenticated queries. The query triggers the stack overflow, causing the server to crash.

Impact

Successful exploitation results in a denial of service (DoS) by crashing the MongoDB server. No data compromise, privilege escalation, or other impacts are possible.

Mitigation

Fixed versions are MongoDB Server v4.2.16, v4.4.10, v5.0.4, and later. [1] For users on v4.2.16 or later and all v4.4 users, a workaround is to set the parameter internalPipelineLengthLimit to 50 at startup. No workaround is available for v5.0 before 5.0.4; upgrading to the fixed version is required.

AI Insight generated on May 26, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.

Affected products

3
  • MongoDB/Serverllm-fuzzy
    Range: >= v4.4.0, <= 4.4.28 || >= v5.0.0, < 5.0.4 || >= v4.2.0, < 4.2.16
  • osv-coords
    Range: >= 4.2.0, < 4.2.16
  • MongoDB Inc./MongoDB Serverv5
    Range: 5.0

Patches

0

No patches discovered yet.

Vulnerability mechanics

No source-code context for this CVE — mechanics is only generated when we can read the actual fix diff. Without that, the four sections (root cause, attack vector, affected code, fix) would be speculation rather than analysis.

References

4

News mentions

0

No linked articles in our index yet.