Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 3 min read

CVE-2026-142596: CVE-2026-142596: Projection Sanitization Bypass and Schema-Level Exclusion Disclosure in Mongoose

CVE-2026-142596: Projection Sanitization Bypass and Schema-Level Exclusion Disclosure in Mongoose Vulnerability ID: CVE-2026-142596 CVSS Score: 7.5 Published: 2026-12-04 A projection sanitization and schema path exc

CVE-2026-142596: Projection Sanitization Bypass and Schema-Level Exclusion Disclosure in Mongoose

Vulnerability ID: CVE-2026-142596
CVSS Score: 7.5
Published: 2026-12-04

A projection sanitization and schema path exclusion bypass vulnerability exists in Mongoose versions 8.5.0 through 8.24.9 and 9.0.0 through 9.12.1. Due to insufficient validation of MongoDB projection syntax in sanitizeProjection and applyPaths, attackers supplying untrusted projection inputs to queries can force the retrieval of sensitive schema fields configured with select: false, such as password hashes, reset tokens, and multi-factor authentication secrets.

TL;DR

Mongoose versions 8.5.0–8.24.9 and 9.0.0–9.12.1 allow remote attackers to bypass sanitizeProjection and schema-level select: false field exclusions via crafted projection operators, nested exclusions, parent path selections, and prototype overrides, resulting in unauthorized disclosure of sensitive database fields.

⚠️ Exploit Status: POC

Technical Details

  • CVE / GHSA ID: CVE-2026-142596 / GHSA-xfcm-rmv3-crmq
  • Weakness Class: CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
  • CVSS v3.1 Score: 7.5 High (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N)
  • Attack Vector: Network (Crafted MongoDB Query Projections)
  • Primary Impact: Disclosure of schema fields marked select: false (passwords, tokens, PII)
  • EPSS Score: 0.69% (54th Percentile)
  • Exploit Status: Proof-of-Concept (Regression tests in official commit)
  • Patched Versions: Mongoose 8.24.10 and 9.12.2

Affected Systems

  • Mongoose ODM (npm package: mongoose) versions 8.5.0 through 8.24.9
  • Mongoose ODM (npm package: mongoose) versions 9.0.0 through 9.12.1
  • mongoose: >= 8.5.0, < 8.24.10 (Fixed in: 8.24.10)
  • mongoose: >= 9.0.0, < 9.12.2 (Fixed in: 9.12.2)

Code Analysis

Commit: c369da4

Hardens sanitizeProjection and applyPaths against expression, parent path, positional, prototype, and discriminator bypasses in Mongoose 8.x.

Commit: c5483b7

Hardens sanitizeProjection and applyPaths against expression, parent path, positional, prototype, and discriminator bypasses in Mongoose 9.x.

Exploit Details

Mitigation Strategies

  • Upgrade Mongoose to the patched release (8.24.10 or 9.12.2) to enforce strict operator allowlisting in sanitizeProjection and proper path stripping in applyPaths.
  • Enforce strict application-level field allowlisting for any API endpoints that allow clients to specify returned fields.
  • Reject object-based or JSON-parsed projections from untrusted requests; restrict client field selection to simple comma- or space-separated leaf field strings validated against an explicit allowlist.
  • Avoid storing high-value secrets (such as password hashes, MFA keys, and reset tokens) in the same MongoDB collection/schema as publicly queryable user profile documents when possible.

Remediation Steps:

  1. Audit package.json and lockfiles (package-lock.json, yarn.lock, pnpm-lock.yaml) to identify Mongoose versions within >= 8.5.0, < 8.24.10 or >= 9.0.0, < 9.12.2.
  2. Run npm install [email protected] (for 8.x) or npm install [email protected] (for 9.x) to apply the security patch.
  3. Search the application codebase for uses of .select(), .find(filter, projection), .findOne(filter, projection), and sanitizeProjection where user input (such as req.query or req.body) is passed.
  4. Verify that queries on base models with discriminators properly enforce schema-level exclusions after upgrading.

References

Read the full report for CVE-2026-142596 on our website for more details including interactive diagrams and full exploit analysis.

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.