Every CVESearch/Get API key

CVE-2026-142596

Mongoose: sanitizeProjection can be bypassed to include fields deselected with `select: false`

Explain with AI
ChatGPTClaudeGoogle AI
Severity
7.5High
Network attack, no privileges, no user interactionCVSS 3.1, CVE List
Exploitation
None reported
1 exploit-related link
Exploit chance
0.69% in 30 days
Percentile54th
EPSS, scored
Listed fix
8.24.10 for mongoose (npm)
From GitHub Advisories and OSV1 more listed version, 3 other affected packages

Overview

Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. From 8.5.0 until 8.24.10 and 9.12.2, Mongoose's sanitizeProjection can be bypassed by +path selections, object or array aggregation expressions, nested and parent projections, positional projections, $meta, discriminator-specific exclusions, an own proto key, and projection-cast error paths. Applications that pass attacker-controlled data to select(), find(filter, projection), or the projection option while relying on sanitizeProjection can return fields marked select: false, including password hashes, reset tokens, API keys, and nested secrets. Nested exclusion objects, $elemMatch combined with an exclusion or a cast error, and discriminator filters can also cause ordinary queries that do not enable sanitizeProjection to omit the select: false exclusions that Mongoose normally adds. This issue is fixed in versions 8.24.10 and 9.12.2.

CVSS 3.1 vector

Exploitability

Attack vector
Network
Complexity
Low
Privileges needed
None
User interaction
None

Impact

Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

Exploit chance over time

Unchanged since Dec 3, 2026
EPSS score 0.69% every day from Dec 3, 2026 to Dec 4, 2026.

Affected

Packages 4

Affected packages
PackageAffectedFixed
mongoose
npm
8.5.0 up to 8.24.10
8.24.10
9.0.0 up to 9.12.2
9.12.2
librechat-0
Docker Hardened Images:Alpine:3.23
0.8.8-r0 and later, plus listed versions
0.8.8-r10.8.8-r20.8.8-r30.8.8-r40.8.8-r5
Show 5 more versionsShow less
0.8.8-r60.8.9-r00.8.9-r10.8.9-r20.8.9-r3
None listed
librechat-0
Docker Hardened Images:Alpine:3.24
0.8.8-r0 and later, plus listed versions
0.8.8-r10.8.8-r20.8.8-r30.8.8-r40.8.8-r5
Show 5 more versionsShow less
0.8.8-r60.8.9-r00.8.9-r10.8.9-r20.8.9-r3
None listed
librechat-0
Docker Hardened Images:Debian:13
0.8.8-0 and later, plus listed versions
0.8.8-10.8.8-20.8.8-30.8.8-40.8.8-5
Show 5 more versionsShow less
0.8.9-00.8.9-10.8.9-20.8.9-30.8.9-4
None listed

Only in multi-CVE advisories 1

Each of these advisories covers several CVEs at once, so it doesn’t establish that this one affects the package.

Packages named only by advisories that cover several CVEs
PackageAffectedFixed
mongoose
TuxCare:npm
9.10.4-tuxcare.0 up to 9.10.4-tuxcare.3, plus listed versions
From an advisory covering 2 CVEs
9.10.49.10.4-tuxcare.19.10.4-tuxcare.2
9.10.4-tuxcare.3
9.10.1-tuxcare.0 up to 9.10.1-tuxcare.2, plus listed versions
From an advisory covering 2 CVEs
9.10.19.10.1-tuxcare.1
9.10.1-tuxcare.2

Products 1

Exploits

Sources link exploit code, tools that only detect the flaw and other work on it, and most don’t say which a link is.

Exploit-related links
LinkSourceDate
googlesky/CVE-2026-142596PoC in GitHub2026-12-04

Sources

CVE List Score usedCVSS 3.17.5

Mongoose: sanitizeProjection can be bypassed to include fields deselected with `select: false`

Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. From 8.5.0 until 8.24.10 and 9.12.2, Mongoose's sanitizeProjection can be bypassed by +path selections, object or array aggregation expressions, nested and parent projections, positional projections, $meta, discriminator-specific exclusions, an own proto key, and projection-cast error paths. Applications that pass attacker-controlled data to select(), find(filter, projection), or the projection option while relying on sanitizeProjection can return fields marked select: false, including password hashes, reset tokens, API keys, and nested secrets. Nested exclusion objects, $elemMatch combined with an exclusion or a cast error, and discriminator filters can also cause ordinary queries that do not enable sanitizeProjection to omit the select: false exclusions that Mongoose normally adds. This issue is fixed in versions 8.24.10 and 9.12.2.

Record
CVE-2026-142596
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Weakness
CWE-200
Updated
2026-12-03
EUVDEUVD-2026-141931CVSS 3.17.5

Mongoose: sanitizeProjection can be bypassed to include fields deselected with select: false

Record
EUVD-2026-141931
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Updated
2026-12-04
GitHub AdvisoriesGHSA-xfcm-rmv3-crmqCVSS 3.17.5

Mongoose: sanitizeProjection can be bypassed to include fields deselected with `select: false`

Summary

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.

Details

Given:

const User = mongoose.model('User', new Schema({
  name: String,
  password: { type: String, select: false },
  profile: { bio: String, ssn: { type: String, select: false } },
  secrets: { type: Map, of: String, select: false },
  recoveryCodes: { type: [String], select: false },
  tags: [String],
  comments: [{ text: String, secret: { type: String, select: false } }]
}));

each of the following returned select: false data with sanitizeProjection enabled:

| Projection | Why it got through | | --- | --- | | select('-name +password') | +path was only blocked in inclusive projections | | select('-+password') | Collapsing - paths turned it into +password | | select('+secrets') | +path was not blocked for map paths | | select({ name: { $concat: ['$password'] } }), select({ name: ['$password'] }) | Object and array values are aggregation expressions; only string values were sanitized | | select({ tags: { $slice: ['$recoveryCodes', 1] } }) | A two-element $slice with an expression is an aggregation expression | | select({ name: { $meta: 'sortKey' } }).sort({ password: 1 }), { $meta: 'indexKey' } | $meta returned sort and index key values | | select({ name: '$password' }) called before sanitizeProjection(true) | String values were only sanitized if the option was set first | | select({ profile: { ssn: 1 } }), select({ profile: { bio: '$password' } }) | Nested sub-projections were not checked | | select('profile') | Selecting a parent path included its select: false children | | select({ 'comments.$': 1 }) | The positional projection returned the whole array element | | select(JSON.parse('{"__proto__":{"password":0}}')) | An own __proto__ key re-pointed the projection object's prototype, hiding select: false exclusions | | select({ profile: { bio: 0 } }) | Nested exclusion objects were treated as inclusive, so select: false exclusions were not added | | select({ tags: { $elemMatch: { $eq: 'a' } }, name: 0 }) | Treated as inclusive, but MongoDB treats it as exclusive | | select({ name: { x: 1, $elemMatch: { $eq: 'a' } } }) | The $elemMatch cast error was swallowed and the whole projection was dropped | | schemaLevelProjections(false) with any expression above | Disabling schema-level projections also disabled sanitizeProjection | | User.findOne({ __t: 'Admin' }) | select: false fields defined only on a discriminator were not excluded, even when the filter selects that discriminator |

For example:

await User.findOne().sanitizeProjection(true).select('-name +password');
// { password: '<password hash>', ... }

await User.findOne().sanitizeProjection(true).select({ name: { $concat: ['$password'] } });
// { name: '<password hash>' }

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.

Proof of concept

Requires a MongoDB server on localhost and npm install mongoose@9.12.1 (or any affected version).

const mongoose = require('mongoose');
const { Schema } = mongoose;

(async () => {
  await mongoose.connect('mongodb://127.0.0.1:27017/sanitize_projection_poc');

  const User = mongoose.model('User', new Schema({
    name: String,
   …
Record
GHSA-xfcm-rmv3-crmq
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Weakness
CWE-200
Updated
2026-12-04
NVDCVSS 3.17.5

Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. From 8.5.0 until 8.24.10 and 9.12.2, Mongoose's sanitizeProjection can be bypassed by +path selections, object or array aggregation expressions, nested and parent projections, positional projections, $meta, discriminator-specific exclusions, an own proto key, and projection-cast error paths. Applications that pass attacker-controlled data to select(), find(filter, projection), or the projection option while relying on sanitizeProjection can return fields marked select: false, including password hashes, reset tokens, API keys, and nested secrets. Nested exclusion objects, $elemMatch combined with an exclusion or a cast error, and discriminator filters can also cause ordinary queries that do not enable sanitizeProjection to omit the select: false exclusions that Mongoose normally adds. This issue is fixed in versions 8.24.10 and 9.12.2.

Record
CVE-2026-142596
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Weakness
CWE-200
Updated
2026-12-03
OSVCVSS 3.17.5

Mongoose: sanitizeProjection can be bypassed to include fields deselected with `select: false`

Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. From 8.5.0 until 8.24.10 and 9.12.2, Mongoose's sanitizeProjection can be bypassed by +path selections, object or array aggregation expressions, nested and parent projections, positional projections, $meta, discriminator-specific exclusions, an own proto key, and projection-cast error paths. Applications that pass attacker-controlled data to select(), find(filter, projection), or the projection option while relying on sanitizeProjection can return fields marked select: false, including password hashes, reset tokens, API keys, and nested secrets. Nested exclusion objects, $elemMatch combined with an exclusion or a cast error, and discriminator filters can also cause ordinary queries that do not enable sanitizeProjection to omit the select: false exclusions that Mongoose normally adds. This issue is fixed in versions 8.24.10 and 9.12.2.

Record
CVE-2026-142596
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Weakness
CWE-200
Updated
2026-12-03
OSVDHI-rv4r-yle2-dbrm-fyvoCVSS 3.17.5

Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. From 8.5.0 until 8.24.10…

Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. From 8.5.0 until 8.24.10 and 9.12.2, Mongoose's sanitizeProjection can be bypassed by +path selections, object or array aggregation expressions, nested and parent projections, positional projections, $meta, discriminator-specific exclusions, an own proto key, and projection-cast error paths. Applications that pass attacker-controlled data to select(), find(filter, projection), or the projection option while relying on sanitizeProjection can return fields marked select: false, including password hashes, reset tokens, API keys, and nested secrets. Nested exclusion objects, $elemMatch combined with an exclusion or a cast error, and discriminator filters can also cause ordinary queries that do not enable sanitizeProjection to omit the select: false exclusions that Mongoose normally adds. This issue is fixed in versions 8.24.10 and 9.12.2.

Record
DHI-rv4r-yle2-dbrm-fyvo
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Updated
2026-12-04
OSVGHSA-xfcm-rmv3-crmqCVSS 3.17.5

Mongoose: sanitizeProjection can be bypassed to include fields deselected with `select: false`

Summary

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.

Details

Given:

const User = mongoose.model('User', new Schema({
  name: String,
  password: { type: String, select: false },
  profile: { bio: String, ssn: { type: String, select: false } },
  secrets: { type: Map, of: String, select: false },
  recoveryCodes: { type: [String], select: false },
  tags: [String],
  comments: [{ text: String, secret: { type: String, select: false } }]
}));

each of the following returned select: false data with sanitizeProjection enabled:

| Projection | Why it got through | | --- | --- | | select('-name +password') | +path was only blocked in inclusive projections | | select('-+password') | Collapsing - paths turned it into +password | | select('+secrets') | +path was not blocked for map paths | | select({ name: { $concat: ['$password'] } }), select({ name: ['$password'] }) | Object and array values are aggregation expressions; only string values were sanitized | | select({ tags: { $slice: ['$recoveryCodes', 1] } }) | A two-element $slice with an expression is an aggregation expression | | select({ name: { $meta: 'sortKey' } }).sort({ password: 1 }), { $meta: 'indexKey' } | $meta returned sort and index key values | | select({ name: '$password' }) called before sanitizeProjection(true) | String values were only sanitized if the option was set first | | select({ profile: { ssn: 1 } }), select({ profile: { bio: '$password' } }) | Nested sub-projections were not checked | | select('profile') | Selecting a parent path included its select: false children | | select({ 'comments.$': 1 }) | The positional projection returned the whole array element | | select(JSON.parse('{"__proto__":{"password":0}}')) | An own __proto__ key re-pointed the projection object's prototype, hiding select: false exclusions | | select({ profile: { bio: 0 } }) | Nested exclusion objects were treated as inclusive, so select: false exclusions were not added | | select({ tags: { $elemMatch: { $eq: 'a' } }, name: 0 }) | Treated as inclusive, but MongoDB treats it as exclusive | | select({ name: { x: 1, $elemMatch: { $eq: 'a' } } }) | The $elemMatch cast error was swallowed and the whole projection was dropped | | schemaLevelProjections(false) with any expression above | Disabling schema-level projections also disabled sanitizeProjection | | User.findOne({ __t: 'Admin' }) | select: false fields defined only on a discriminator were not excluded, even when the filter selects that discriminator |

For example:

await User.findOne().sanitizeProjection(true).select('-name +password');
// { password: '<password hash>', ... }

await User.findOne().sanitizeProjection(true).select({ name: { $concat: ['$password'] } });
// { name: '<password hash>' }

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.

Proof of concept

Requires a MongoDB server on localhost and npm install mongoose@9.12.1 (or any affected version).

const mongoose = require('mongoose');
const { Schema } = mongoose;

(async () => {
  await mongoose.connect('mongodb://127.0.0.1:27017/sanitize_projection_poc');

  const User = mongoose.model('User', new Schema({
    name: String,
   …
Record
GHSA-xfcm-rmv3-crmq
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Weakness
CWE-200
Updated
2026-12-04
OSVCLSA-2026-1796376974No score

TuxCare security update for mongoose (2 CVEs)

TuxCare rebuilt mongoose to address 2 CVEs. Fixed in 9.10.4-tuxcare.3.

Record
CLSA-2026-1796376974
Updated
2026-12-05
OSVCLSA-2026-1796426791No score

TuxCare security update for mongoose (2 CVEs)

TuxCare rebuilt mongoose to address 2 CVEs. Fixed in 9.10.1-tuxcare.2.

Record
CLSA-2026-1796426791
Updated
2026-12-05

The JSON record also has the rest of 2 source descriptions.

History

Recorded by Every CVE

Changes recorded by Every CVE
DayChangedSources
Affected packagesNot recorded
Affected packages, other IDsOSV
Affected packages, other IDsOSV
Exploit links, key factsPoC in GitHub
Affected packages, other IDs, referencesOSV
Published dateEUVD
Affected packages, referencesOSV
Affected packages, key facts, references
4 sourcesShow lessCVE List, GitHub Advisories, NVD, OSV
Other IDs, referencesOSV
Other IDs, published dateEUVD, NVD
First indexedCVE List

Upstream dates may differ.

References

MoveEnter Open