CVE-2026-142596: Mongoose: sanitizeProjection can be bypassed to include fields deselected with `select: false`
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.
References
- github.com/Automattic/mongoose/commit/c369da407ee8bea907bb5af7bb94ce5deeb3e0e4
- github.com/Automattic/mongoose/commit/c5483b71438ececde3a272feef65e14666614093
- github.com/Automattic/mongoose/releases/tag/8.24.10
- github.com/Automattic/mongoose/releases/tag/9.12.2
- github.com/Automattic/mongoose/security/advisories/GHSA-xfcm-rmv3-crmq
- github.com/advisories/GHSA-xfcm-rmv3-crmq
- nvd.nist.gov/vuln/detail/CVE-2026-142596
Code Behaviors & Features
Detect and mitigate CVE-2026-142596 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →