All vulnerabilities

npm

CVE-2026-125118

Mongoose: Prototype pollution via Schema.prototype.virtual()

Severity
Medium 6.5
Published
10 Nov 2026
Last changed
10 Nov 2026
Added to UpHeron
23 Nov 2026
Fixed in
6.13.12, 7.8.13, 8.24.7, 9.11.4
Exploit chance
0.6% in the next 30 daysHigher than 49% of CVEs. EPSS by FIRST, 24 Nov 2026
Weakness
Prototype pollution (CWE-1321)
Attack
Over the network · No login needed · No user action needed
Attacker can
Change some data · Slow it down
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:L
Also known as
GHSA-6972-9mcm-vhwj
Sources
OSV.dev and GitHub

Description

Prototype pollution via Schema.prototype.virtual() — the 2022 fix for CVE-2022-2564 / CVE-2022-24304 protected Schema.path()/add() but never virtual(), so the same class of bug is still exploitable in all maintained release lines.

In lib/schema.js, Schema.prototype.virtual() (defined at line 2643) builds the virtual path via:

Unlike path()/add(), virtual() never received the specialProperties check added for CVE-2022-2564/CVE-2022-24304 (lib/schema.js lines 806, 1308, 1331).

A path containing proto/constructor/prototype segments resolves through the prototype chain and writes onto Object.prototype / Function.prototype.

Attacker-influenced schema field names (dynamic schemas, CMS form builders, schema-as-code) allow pollution of Object.prototype (own, enumerable keys visible on every object — e.g. ({}).isAdmin checks can be spoofed) and Function.prototype (a known gadget primitive in server-side JS).

From the GitHub Advisory Database, CC BY 4.0.

Affected software

SoftwareAffected versions
mongoosenpm · osv:npm:mongoose
  • Every version before 6.13.12
  • From 7.0.0 before 7.8.13
  • From 8.0.0 before 8.24.7
  • From 9.0.0 before 9.11.4

About mongoose

Weekly downloads (npm)
9,379,180npm, 24 Nov 2026

References