CVE-2026-142596 — Mongoose — CWE-200
### 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: ```javascript 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 san
### 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: ```javascript 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 san
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
CVE-2026-142596
CVSS 7.5/10 · HIGH · 02.12.2026
CWE: CWE-200
Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
🎯 WHAT IS THIS VULNERABILITY?
Summary: ### 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…
Affected: mongoose
⚡ ATTACK VECTOR
Network / Remote (AV:N) · no authentication required (PR:N) · no user interaction (UI:N) · low attack complexity (AC:L).
🌍 REAL WORLD IMPACT
All confidential data readable/stealable.
🛡️ REMEDIATION
→ Apply vendor security update for mongoose.
→ Pre-patch: put service behind VPN or apply IP allowlist.
→ Add WAF rule, create IDS alert for anomalous traffic.
⚠️ URGENCY
⚠️ This week (7 days) — High risk, anonymous remote.
────────────────────────────────────────
[Automated Technical Vulnerability & CVSS Vector Analysis]