All vulnerabilities

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.

From the GitHub Advisory Database, CC BY 4.0. Shortened; the full text is there.

Affected software

SoftwareAffected versions
mongoosenpm · osv:npm:mongoose
  • From 8.5.0 before 8.24.10
  • From 9.0.0 before 9.12.2

About mongoose

Weekly downloads (npm)
8,359,311npm, 1 Dec 2026

References