CVE-2025-23061CWE-94

Mongoose before 8.9.5 can improperly use a nested $where filter with a populate() match, leading to search injection

Critical · published January 15, 2025

CVSS v3.1
9.0
EPSS
7%
Percentile
94.3
In the wild
Unconfirmed
What it is

🔥 An incomplete fix is the root of a devastating search injection flaw in Mongoose before 8.9.5! Think of it as a hotel reservation system that accidentally allows guests to book rooms by entering any string in a comments field—there's no filtering happening at all! This results in a whole lot of unexpected and unwanted behavior. An attacker could exploit this flaw to manipulate queries, potentially retrieving sensitive data or tampering with results—talk about a recipe for chaos! If your database is exposed, you might be looking at significant data leaks or unauthorized access. That’s absolutely devastating for your application's integrity!

Put simply

Think of it as a hotel reservation system that accidentally allows guests to book rooms by entering any string in a comments field—there's no filtering happening at all! This results in a whole lot of unexpected and unwanted behavior. This vulnerability arises from improper use of a nested $where filter combined with a populate() match in Mongoose, allowing attackers to inject arbitrary queries, which could lead to unauthorized data access or manipulation.

What to do

An attacker could exploit this flaw to manipulate queries, potentially retrieving sensitive data or tampering with results—talk about a recipe for chaos! If your database is exposed, you might be looking at significant data leaks or unauthorized access. That’s absolutely devastating for your application's integrity! Update Mongoose to version 8.9.5 or later immediately to close this critical hole. Ensure you have robust input sanitation in place to prevent query manipulation. Conduct a thorough review of your query logic to ensure it’s secure against injection attacks. You've got this! With these steps, you’ll be well on your way to securing your application and earning that security hero badge! 🦸‍♂️

The record
Technical detail
CVSS v3.1
9.0 · CRITICAL
Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:H/I:H/A:H
CVSS v4.0
Not supplied
EPSS
0.07236 · 94.3th percentile
Weakness
CWE-94 · Improper Control of Generation of Code ('Code Injection')
Published
2025-01-15T00:00Z
EPSS history
Timeline
  • 15 JAN 00:00Z
    Mongoose before 8.9.5 can improperly use a nested $where filter with a populate() match, leading to search injection
    cvelistv5