Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSubmit crafted filter value with query operator
-
DeliveryValue reaches countDocuments() with sanitizeFilter enabled
-
ExploitOperator processed instead of literal
-
ExecutionCount includes documents that should not match
-
ImpactAuthorization or application logic bypassed
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Query language parameterization
|
| Exploitation Conditions | Two concrete prerequisites must both hold: (1) the application has enabled Mongoose's sanitizeFilter defense (via query option, schema/connection option, or mongoose.sanitizeFilter), and (2) it passes attacker-controlled filter values directly into countDocuments() (or deprecated count()) and makes a security or logic decision based on the returned count. Limiting factors: only Mongoose versions <6.13.11, 7.0.0-7.8.11, 8.0.0-8.24.2, and 9.0.0-9.9.1 are affected; applications that do not use sanitizeFilter, or that do not derive authorization/logic from countDocuments() output, gain no additional exposure from this specific flaw; and the realistic impact is bounded to count accuracy rather than direct data modification. |
| Impact | The input lists CVSS 9.8 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H) and the vuln.today Decision label is act_now, but these signals materially overstate the real-world impact described. The actual flaw is that Mongoose's countDocuments() skips the sanitizeFilter query-selector-injection defense, so a count can be inflated/skewed by injected query operators and any authorization or application logic keyed off that count can be undermined. That is an integrity/logic problem, not the full confidentiality+integrity+availability compromise (C:H/I:H/A:H) implied by the 9.8 - there is no code execution and no inherent full data read or service loss from the described defect, though a count can be abused as a blind boolean oracle to infer data. The network reachability (AV:N, AC:L, PR:N) is plausible because filter values typically come from untrusted request input. No EPSS score, no CISA KEV listing, and no confirmed public exploit code were provided, so nothing indicates active or widespread exploitation; exploitability is further gated on the application having opted into sanitizeFilter and feeding attacker-controlled values to countDocuments(). Net: treat this as a defense-in-depth regression to patch promptly per the act_now label and vendor guidance, but the 9.8/C:H/I:H/A:H rating conflicts with the limited described mechanism and should be read as inflated - verify the real blast radius against your own application's use of countDocuments() for security decisions. |
| Exploit ScenarioDerived | An application that enables sanitizeFilter relies on it to safely pass a user-supplied value (e.g. a username or token field) into countDocuments() for a uniqueness, ownership, or authorization check. Because sanitizeFilter is not applied there, an attacker submits a filter value containing a query operator such as {"$ne": null}, which Mongoose treats as an operator rather than a literal, inflating or skewing the count and bypassing the logic gated on it. No public exploit code was identified; the fix commits ship regression tests that demonstrate the injected-operator behavior. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Nov 09, 2026
Query-selector injection in Mongoose's countDocuments() (and the deprecated count()) lets remote, unauthenticated attackers slip MongoDB operator objects past the sanitizeFilter defense in versions prior to 6.13.11, 7.8.12, 8.24.3 and 9.9.2. Because the count filter is cast without sanitization, injected operators such as $ne change which documents match, so an application that enables sanitizeFilter and derives an authorization or business-logic decision from the returned count can be misled; the realistic impact is bounded to count accuracy rather than data modification or direct read of records. Patched releases exist for every supported major line and no public exploit code has been identified at time of analysis, although vuln.today assigns the act_now decision label; the published CVSS 9.8 base score overstates practical risk, since exploitation requires sanitizeFilter to be enabled and a security or logic decision to depend on the count result.
RemediationAI
Vendor-released patches are available: upgrade to mongoose ^6.13.11, ^7.8.12, ^8.24.3 or ^9.9.2 depending on the major line in use, following the advisory at https://github.com/Automattic/mongoose/security/advisories/GHSA-pcrw-h46h-c93h and the corresponding release tags (6.13.11, 7.8.12, 8.24.3, 9.9.2). If upgrading immediately is not possible, the vendor documents a middleware workaround that forces sanitization on the count path: register a global plugin whose schema.pre('countDocuments') hook calls mongoose.sanitizeFilter(this.getFilter()); the trade-off is that this hook only covers countDocuments(), so the deprecated count() and cursor() paths - which the upstream fix also addresses - remain unsanitized and must be handled separately or avoided, and any sanitizeFilter rejection will now throw (including for $where) so callers must handle the resulting errors rather than silently receiving a count. Because this CVE is only exploitable when sanitizeFilter is enabled, applications that never opted in are unaffected by this specific flaw, but they should still treat countDocuments() filters as untrusted input and avoid deriving authorization decisions from a count computed over attacker-influenced filters. Advisory and commit references: GHSA-pcrw-h46h-c93h, commits 7e912af3fac52cb0eea4cd71e24d65318916831a, 8b10d5760bb181f5bf5d01495cde161c8aed0557, b1df045aab076b740fdaec14a15a44c694b85b7d and b5003d3915db1cf9209c38a4b93cf3a92cddd710.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in npm
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
Mongoose is the MongoDB object modeling (ODM) layer for Node.js, translating JavaScript filter objects into MongoDB query documents. Its sanitizeFilter option is the built-in defense against query-selector (NoSQL) injection: it wraps user-supplied operator objects in $eq so that a value like {$ne: null} is compared literally instead of being executed as an operator, and it refuses outright filters such as $where. This flaw is CWE-943 (improper neutralization of special elements in data query logic): the sanitization step was wired into find/findOne-style paths but skipped the countDocuments() code path, and the commit diff shows the fix routing these paths through a new _castConditions() helper that applies sanitizeFilter before casting. The accompanying tests show the intended post-fix behavior - an injected operator is wrapped in $eq and then fails schema casting with a CastError on a string path, $where raises "$where is not allowed with sanitizeFilter", and deliberate operators must be wrapped in mongoose.trusted() to pass. The same commit extends sanitization to the deprecated count() method and to cursor() queries, and notes that a sanitizeFilter rejection can surface as a query error rather than a cast error. Only deployments that opt into sanitizeFilter are protected by it at all, which is why the flaw matters solely to those applications.
Know when Mongoose gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Filter values are typically remote untrusted input (AV:N, AC:L, PR:N), but impact is limited to skewing a count that undermines app logic, so C:L/I:L/A:N rather than the input's C:H/I:H/A:H.
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
2DescriptionCVE.org
Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. Prior to 6.13.11, 7.8.12, 8.24.3, and 9.9.2, Mongoose countDocuments() does not apply the configured sanitizeFilter query selector injection defense. An application that enables sanitizeFilter and passes attacker-controlled filter values to countDocuments() can therefore process query operator objects as operators rather than literal values, causing the count to include documents that should not match and potentially undermining authorization or application logic based on that count. This issue is fixed in versions 6.13.11, 7.8.12, 8.24.3, and 9.9.2.
Blast Radius
ecosystem impact- 2 npm packages depend on mongoose (2 direct, 0 indirect)
Ecosystem-wide dependent count for version 7.0.0.
Technical POC Analysis
Bug class: CWE-943, Improper Neutralization of Special Elements in Data Query Logic.
Full technical POC analysis - root cause, step-by-step exploitation and patch breakdown - is part of the Pro and Business plans.
Executive ViewAI
A critical query-selector injection vulnerability in Mongoose's count functions could let unauthenticated attackers bypass filter sanitization and manipulate document counts. This may undermine authorization or business-logic decisions that rely on counts, affecting applications that use sanitizeFilter. Leadership should prioritize patching to prevent potential data integrity and access control issues.
Apply vendor patch.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Code injection occurs when an application accepts user input and passes it directly into a language interpreter or evaluator without proper sanitization.
NoSQL injection exploits databases that don't use traditional SQL syntax-like MongoDB, CouchDB, or Redis-by manipulating queries through unsanitized user input.
Mongoose ODM for Node.js before version 8.9.5 contains a search injection vulnerability when using $where filters with p
An exploitable stack buffer overflow vulnerability exists in the MQTT packet parsing functionality of Cesanta Mongoose 6
An exploitable use-after-free vulnerability exists in the HTTP server implementation of Cesanta Mongoose 6.8. Rated crit
An exploitable memory corruption vulnerability exists in the Websocket protocol implementation of Cesanta Mongoose 6.8.
An exploitable memory corruption vulnerability exists in the Websocket protocol implementation of Cesanta Mongoose 6.8.
Prototype Pollution in GitHub repository automattic/mongoose prior to 7.3.4. Rated critical severity (CVSS 9.8), this vu
Prototype Pollution in GitHub repository automattic/mongoose prior to 6.4.6. Rated critical severity (CVSS 9.8), this vu
An integer overflow in parse_mqtt in mongoose.c in Cesanta Mongoose 6.16 allows an attacker to achieve remote DoS (infin
Mongoose before 8.8.3 can improperly use $where in match, leading to search injection. Rated critical severity (CVSS 9.1
The mg_tls_init function in Cesanta Mongoose HTTPS server 7.0 (compiled with OpenSSL support) is vulnerable to remote OO
The mg_tls_init function in Cesanta Mongoose HTTPS server 7.0 and 6.7-6.18 (compiled with mbedTLS support) is vulnerable
The mg_http_serve_file function in Cesanta Mongoose HTTP server 7.0 is vulnerable to remote OOB write attack via connect
EUVD-2026-120503
GHSA-pcrw-h46h-c93h
NVD
CVE.org
EPSS
VulDB
Exploit-DB