CVE-2025-23061: Mongoose search injection vulnerability
9.1
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.25395%
CWE
Published
1/15/2025
Updated
1/17/2025
KEV Status
No
Technology
JavaScript
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| mongoose | npm | >= 8.0.0-rc0, < 8.9.5 | 8.9.5 |
| mongoose | npm | >= 7.0.0-rc0, < 7.8.4 | 7.8.4 |
| mongoose | npm | < 6.13.6 | 6.13.6 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from improper validation of the $where operator in populate() match clauses. The original code in getModelsMapForPopulate.js checked for $where at the top level or in arrays but failed to recursively inspect nested objects (e.g., $or, $and). The patch introduced a recursive throwOn$where function to address this. The affected functions (getModelsMapForPopulate and _virtualPopulate) processed the match parameter without this recursive check in vulnerable versions, making them entry points for injection. The commit diff and CVE description explicitly reference this population match handling as the flawed component.