GitHub Advisoryadvisory · npm
GHSA-vg7j-7cwx-8wgw Mongoose search injection vulnerability
CRITICAL
Official page ↗
- Aliases
- CVE-2025-23061
- Ecosystem
- npm
- Packages
- mongoose
- Severity
- Critical
- CVSS vector
- CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H
- Weaknesses
- CWE-94
- Reviewed
- 2025-01-16
Affected packages
• npm mongoose: >= 8.0.0-rc0, < 8.9.5 → fixed in 8.9.5
• npm mongoose: >= 7.0.0-rc0, < 7.8.4 → fixed in 7.8.4
• npm mongoose: < 6.13.6 → fixed in 6.13.6
Description
Mongoose versions prior to 8.9.5, 7.8.4, and 6.13.6 are vulnerable to improper use of the `$where` operator. This vulnerability arises from the ability of the `$where` clause to execute arbitrary JavaScript code in MongoDB queries, potentially leading to code injection attacks and unauthorized access or manipulation of database data.
NOTE: this issue exists because of an incomplete fix for CVE-2024-53900.
Related
Alias · CVE (1)
- CVE-2025-23061 Mongoose before 8.9.5 can improperly use a nested $where filter with a populate() match, leading to search injection. vulnerability
Weakness · CWE (1)
- CWE-94 Improper Control of Generation of Code weakness
References
- https://nvd.nist.gov/vuln/detail/CVE-2025-23061 advisory
- https://github.com/Automattic/mongoose/commit/64a9f9706f2428c49e0cfb8e223065acc645f7bc web
- https://github.com/Automattic/mongoose package
- https://github.com/Automattic/mongoose/blob/master/CHANGELOG.md web
- https://github.com/Automattic/mongoose/compare/6.13.5...6.13.6 web
- https://github.com/Automattic/mongoose/compare/7.8.3...7.8.4 web
- https://github.com/Automattic/mongoose/compare/8.9.4...8.9.5 web
- https://github.com/Automattic/mongoose/releases/tag/6.13.6 web
- https://github.com/Automattic/mongoose/releases/tag/7.8.4 web
- https://github.com/Automattic/mongoose/releases/tag/8.9.5 web
- https://github.com/advisories/GHSA-m7xq-9374-9rvx advisory
- https://www.npmjs.com/package/mongoose?activeTab=versions web