CVE-2025-23061 Mongoose search injection vulnerability

Critical 9.0 Published Updated

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.

PackageAffectedFixed in
mongoose BitnamiFrom 6.0.06.13.6, 7.8.4, 8.9.5
mongoose npmAll versions6.13.6
mongoose npmAll versions6.13.6
mongoose npmFrom 7.0.0-rc07.8.4
mongoose npmFrom 7.0.0-rc07.8.4
mongoose npmFrom 8.0.0-rc08.9.5
1 more packages
mongoose npmFrom 8.0.0-rc08.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.

Sources

Also known as BIT-mongoose-2025-23061, CLSA-2026-1774916722, CLSA-2026-1777250310, GHSA-vg7j-7cwx-8wgw, ROOT-APP-NPM-CVE-2025-23061.

Is CVE-2025-23061 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free