CriticalGHSA-vg7j-7cwx-8wgwBIT-mongoose-2025-23061CVE-2025-23061

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
Update to the fixed version for your release line, for example:npm install mongoose@8.9.5
Affected
>=7.0.0-rc0 <7.8.4
Fixed in
7.8.4
Update to the fixed version for your release line, for example:npm install mongoose@7.8.4
Affected
<6.13.6
Fixed in
6.13.6
Update to the fixed version for your release line, for example:npm install mongoose@6.13.6

Details

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

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.