CVE-2025-23061 Mongoose search injection vulnerability
Attackers can execute arbitrary code via search injection in Mongoose ODM using nested $where filters with populate().
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2025-23061?
CVE-2025-23061 is a critical code injection vulnerability in mongoosejs Mongoose, published on 15 Jan 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
Mongoose before 8.9.5 can improperly use a nested $where filter with a populate() match, leading to search injection. NOTE: this issue exists because of an incomplete fix for CVE-2024-53900.
Weakness: CWE-94
Which versions are affected by CVE-2025-23061?
7 open source packages ship an affected version, including mongoose. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
mongoose Bitnami | From 6.0.0 | 6.13.6, 7.8.4, 8.9.5 |
mongoose npm | All versions | 6.13.6 |
mongoose npm | All versions | 6.13.6 |
mongoose npm | From 7.0.0-rc0 | 7.8.4 |
mongoose npm | From 7.0.0-rc0 | 7.8.4 |
mongoose npm | From 8.0.0-rc0 | 8.9.5 |
1 more packages
mongoose npm | From 8.0.0-rc0 | 8.9.5 |
Products include Mongoosejs Mongoose.
How do I fix CVE-2025-23061?
Upgrade mongoose to a fixed version for your release line: 6.13.6, 7.8.4 or 8.9.5.
Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.
Is CVE-2025-23061 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-23061 exists.
Public exploit code: 1 Nuclei template and 2 proofs of concept on GitHub.
Other vulnerabilities in mongoosejs Mongoose
- CVE-2023-3696 Prototype Pollution in automattic/mongoose
- CVE-2024-53900 Mongoose search injection vulnerability
- CVE-2019-17426 Improper Input Validation in Automattic Mongoose
- CVE-2026-42334 Mongoose: Improper Sanitization of $nor in sanitizeFilter May Allow NoSQL Injection
- CVE-2022-2564 Prototype Pollution in automattic/mongoose
Sources
Also known as BIT-mongoose-2025-23061, CLSA-2026-1774916722, CLSA-2026-1777250310, GHSA-vg7j-7cwx-8wgw, ROOT-APP-NPM-CVE-2025-23061.