Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. mongoose
  4. ›
  5. CVE-2026-142595

CVE-2026-142595: Mongoose: `sanitizeFilter` bypass via MongoDB internal top-level query operators such as `$_internalSchemaXor`

December 4, 2026

Mongoose’s sanitizeFilter option is meant to block query selector injection. Before this fix, it only refused four top-level operators by name: $jsonSchema, $where, $expr and $text. Any other top-level $ operator was passed to MongoDB unchanged. That includes undocumented internal operators like $_internalSchemaXor and $_internalSchemaCond, which take sub-filters, and sanitizeFilter never inspected those sub-filters. An attacker who controls the keys of a query filter could use them to slip arbitrary query selectors like $ne or $regex past sanitizeFilter.

References

  • github.com/Automattic/mongoose/commit/34e76947cc8a9ceb916c233aec01aea060bc3dba
  • github.com/Automattic/mongoose/commit/3e5f4c8b30ef42db1ab9f2794dc77c95f21d3835
  • github.com/Automattic/mongoose/commit/4627d2fc572a943ee7afe26a1bcebe493dbd2508
  • github.com/Automattic/mongoose/commit/c6a4c95f9b15d81a352f2934c91b64ece583c2db
  • github.com/Automattic/mongoose/releases/tag/7.8.14
  • 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-25v4-hrwm-qj9f
  • github.com/advisories/GHSA-25v4-hrwm-qj9f
  • nvd.nist.gov/vuln/detail/CVE-2026-142595

Code Behaviors & Features

Detect and mitigate CVE-2026-142595 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 →

Affected versions

All versions before 6.13.13, all versions starting from 7.0.0 before 7.8.14, all versions starting from 8.0.0 before 8.24.10, all versions starting from 9.0.0 before 9.12.2

Fixed versions

  • 6.13.13
  • 7.8.14
  • 8.24.10
  • 9.12.2

Solution

Upgrade to versions 6.13.13, 7.8.14, 8.24.10, 9.12.2 or above.

Impact 6.5 MEDIUM

CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:L/A:N

Learn more about CVSS

Weakness

  • CWE-943: Improper Neutralization of Special Elements in Data Query Logic

Source file

npm/mongoose/CVE-2026-142595.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Fri, 04 Dec 2026 00:17:04 +0000.