CVE-2022-24304: Mongoose prototype pollution in Schema.path()

CVE-2022-24304 · Severity: low · CVSS 3.1 · Published 2022-08-27

Mongoose is a popular Node.js library for interacting with MongoDB databases. This vulnerability allows an attacker to pollute the JavaScript Object prototype through the Schema.path() function, potentially causing application crashes (denial of service), property injection, or other exploits. Applications using affected versions are at risk if they process untrusted input when defining database schemas.

Technologies: mongoose (npm). Vendors: npm.

Quick answers

Is CVE-2022-24304 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2022-24304 being exploited in the wild.
How severe is CVE-2022-24304?
Low severity, with a CVSS score of 3.1, published 27 August 2022.
Which products and versions are affected?
mongoose (npm) SEMVER:introduced=6.0.0,fixed=6.4.6.
Is there a fix for CVE-2022-24304?
Yes. mongoose (npm): upgrade to 6.4.6 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2022-24304 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2022-24304?
Check whether you run mongoose (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • mongoose (npm): upgrade to 6.4.6 or later
    npm install mongoose@6.4.6

Technical details

The Schema.path() function in Mongoose versions 0–5.13.14 and 6.0.0–6.4.5 is vulnerable to prototype pollution due to insufficient validation of input passed to the schema object. An attacker can supply a malicious payload (e.g., '__proto__.toString') to the schema.path() method to pollute the Object prototype. No authentication is required; the attack only requires the ability to call Schema.path() with attacker-controlled input. This can result in denial of service (application crashes), property injection, and potentially remote code execution. Fixes were released in Mongoose 5.13.15 and 6.4.6.

Affected products

  • Automattic Mongoose 0 to 5.13.14, 6.0.0 to 6.4.5

Identifiers

  • CVE-2022-24304
  • GHSA-h8hf-x3f4-xwgp

Timeline

  • 2022-07-09: disclosed: Vulnerability reported privately via huntr.dev
  • 2022-08-26: advisory: Vulnerability published in NVD
  • 2022-08-27: patched: Fixes released in Mongoose 5.13.15 and 6.4.6

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.