Mongoose search injection vulnerability
Published 15 Jan 2025 · Updated 3 Oct 2025
Affected packages
- Affected
- >=8.0.0-rc0 <8.9.5
- Fixed in
- 8.9.5
npm install mongoose@8.9.5- Affected
- >=7.0.0-rc0 <7.8.4
- Fixed in
- 7.8.4
npm install mongoose@7.8.4- Affected
- <6.13.6
- Fixed in
- 6.13.6
npm install mongoose@6.13.6Details
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.
Is GHSA-vg7j-7cwx-8wgw in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected mongoose, and gives you the command that fixes it.
References
- Advisorynvd.nist.gov/vuln/detail/CVE-2025-23061
- Linkgithub.com/Automattic/mongoose/commit/64a9f9706f2428c49e0cfb8e223065acc645f7bc
- Packagegithub.com/Automattic/mongoose
- Linkgithub.com/Automattic/mongoose/blob/master/CHANGELOG.md
- Linkgithub.com/Automattic/mongoose/compare/6.13.5...6.13.6
- Linkgithub.com/Automattic/mongoose/compare/7.8.3...7.8.4
- Linkgithub.com/Automattic/mongoose/compare/8.9.4...8.9.5
- Linkgithub.com/Automattic/mongoose/releases/tag/6.13.6
- Linkgithub.com/Automattic/mongoose/releases/tag/7.8.4
- Linkgithub.com/Automattic/mongoose/releases/tag/8.9.5
- Advisorygithub.com/advisories/GHSA-m7xq-9374-9rvx
- Linkwww.npmjs.com/package/mongoose?activeTab=versions
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.