npm
CVE-2026-142596
Mongoose: sanitizeProjection can be bypassed to include fields deselected with `select: false`
- Severity
- High 7.5
- Published
- 4 Dec 2026
- Last changed
- 4 Dec 2026
- Added to UpHeron
- 4 Dec 2026
- Fixed in
- 8.24.10, 9.12.2
- Weakness
- Information exposure (CWE-200)
- Attack
- Over the network · No login needed · No user action needed
- Attacker can
- Read data
- CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N- Also known as
- GHSA-xfcm-rmv3-crmq
- Sources
- OSV.dev and GitHub
Description
Since Mongoose 8.5.0, the sanitizeProjection option prevents untrusted projections from including fields that the schema deselects with select: false, like password hashes and reset tokens. Several projection forms got around that check, so a user-controlled projection could still return select: false fields even with sanitizeProjection enabled.
Mongoose versions before 8.5.0 do not make sanitizeProjection block including select: false keys - hiding select: false keys was a new feature introduced in Mongoose 8.5.0.
Given:
each of the following returned select: false data with sanitizeProjection enabled:
For example:
Nested exclusion objects, $elemMatch combined with an exclusion, $elemMatch cast errors, and discriminator filters also affect queries that do not use sanitizeProjection, because they cause Mongoose to leave out the select: false exclusions it normally adds.
Affected software
| Software | Affected versions |
|---|---|
mongoosenpm · osv:npm:mongoose |
|
About mongoose
- Weekly downloads (npm)
- 8,359,311npm, 1 Dec 2026
Vulnerabilities in mongoose
- In our list
- 8
- Published in the last 12 months
- 8
- Critical, last 12 months
- 1
- High, last 12 months
- 3
- Known exploited
- 0
- CVE-2026-142595Mongoose: `sanitizeFilter` bypass via MongoDB internal top-level query operators such as `$_internalSchemaXor`Medium 6.5 4 Dec 2026
- CVE-2026-142608Mongoose: Plain objects with a forged _bsontype bypass ObjectId and String casting, leaking and replaying data from other commandLow 3 Dec 2026
- CVE-2026-125116Mongoose: Discriminator key values matching inherited properties (e.g. __t: 'constructor') bypass schema casting and can poison collectionsMedium 4.8 10 Nov 2026
- CVE-2026-125117Mongoose walks into inherited properties when hydrating, setting, and merging, allowing overwrites of built-in functions (denial of service) and shared schema stateHigh 8.2 10 Nov 2026
- CVE-2026-125118Mongoose: Prototype pollution via Schema.prototype.virtual()Medium 6.5 10 Nov 2026
- CVE-2026-125119Mongoose: Connection-level sanitizeFilter not appliedHigh 7.5 10 Nov 2026
References
- CVE.org https://www.cve.org/CVERecord?id=CVE-2026-142596
- GitHub Advisory Database https://github.com/advisories/GHSA-xfcm-rmv3-crmq