GitHub Advisoryadvisory · npm

GHSA-vg7j-7cwx-8wgw Mongoose search injection vulnerability

CRITICAL Published 2025-01-15 Modified 2025-10-03 Official page ↗
Aliases
CVE-2025-23061
Ecosystem
npm
Packages
mongoose
Severity
Critical
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H
Weaknesses
CWE-94
Reviewed
2025-01-16

Affected packages

• npm mongoose: >= 8.0.0-rc0, < 8.9.5 → fixed in 8.9.5 • npm mongoose: >= 7.0.0-rc0, < 7.8.4 → fixed in 7.8.4 • npm mongoose: < 6.13.6 → fixed in 6.13.6

Description

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.

Related

Alias · CVE (1)

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

Weakness · CWE (1)

  • CWE-94 Improper Control of Generation of Code weakness

References