Improper Neutralization of Special Elements in Data Query Logic Affecting mongoose package, versions <6.13.11>=7.0.0 <7.8.12>=8.0.0 <8.24.3>=9.0.0 <9.9.2


Severity

Recommended
0.0
critical
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.57% (48th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Improper Neutralization of Special Elements in Data Query Logic vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-MONGOOSE-22409029
  • published11 Nov 2026
  • disclosed10 Nov 2026
  • creditYounghun Ko

Introduced: 10 Nov 2026

NewCVE-2026-125120  (opens in a new tab)
CWE-943  (opens in a new tab)

How to fix?

Upgrade mongoose to version 6.13.11, 7.8.12, 8.24.3, 9.9.2 or higher.

Overview

mongoose is a Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment.

Affected versions of this package are vulnerable to Improper Neutralization of Special Elements in Data Query Logic via countDocuments() queries, which do not apply sanitizeFilter - Mongoose's mechanism for protecting against query selector injection attacks. An attacker who can control filter input to countDocuments() can inject MongoDB query selectors, bypassing the sanitization that is applied to other query methods. The fix extends _castConditions() (which internally invokes sanitizeFilter) to _countDocuments and cursor operations.

CVSS Base Scores

version 4.0
version 3.1