MongoDB Mongoose Search Injection Vulnerability (CVE-2025-23061)

MongoDB Mongoose Search Injection Vulnerability (CVE-2025-23061)

January 21, 2025 | NSFOCUS

Overview

Recently, NSFOCUS CERT detected a security announcement issued by GitHub that fixed a search injection vulnerability (CVE-2025-23061) in Mongoose, which is an incomplete fix for CVE-2024-53900. Because Mongoose incorrectly handles the $where filter with match conditions in the populate() method, an unauthenticated attacker can manipulate a search injection when both queries are used, resulting in code injection or unauthorized database access. The CVSS score is 9.0, please take measures for protection as soon as possible.

Reference link: https://github.com/advisories/GHSA-vg7j-7cwx-8wgw

Scope of Impact

Affected version

  • 8.0.0-rc0 <= MongoDB Mongoose < 8.9.5
  • 7.0.0-rc0 <= MongoDB Mongoose < 7.8.4
  • MongoDB Mongoose < 6.13.6

Unaffected version

  • MongoDB Mongoose >= 8.9.5
  • MongoDB Mongoose >= 7.8.4
  • MongoDB Mongoose >= 6.13.6

Detection

Users can use the following command to determine whether there is a security risk in the current Mongoose version:

npm list mongoose

Mitigation

At present, a new version has been officially released to fix this vulnerability. Please upgrade the affected version for protection as soon as possible.

Download link: https://github.com/Automattic/mongoose/releases

Users can upgrade to the corresponding security version by using the following command:

npm install mongoose@latest

Statement

This advisory is only used to describe a potential risk. NSFOCUS does not provide any commitment or promise on this advisory. NSFOCUS and the author will not bear any liability for any direct and/or indirect consequences and losses caused by transmitting and/or using this advisory. NSFOCUS reserves all the rights to modify and interpret this advisory. Please include this statement paragraph when reproducing or transferring this advisory. Do not modify this advisory, add/delete any information to/from it, or use this advisory for commercial purposes without permission from NSFOCUS.

About NSFOCUS

NSFOCUS, a pioneering leader in cybersecurity, is dedicated to safeguarding telecommunications, Internet service providers, hosting providers, and enterprises from sophisticated cyberattacks.

Founded in 2000, NSFOCUS operates globally with over 4000 employees at two headquarters in Beijing, China, and Santa Clara, CA, USA, and over 50 offices worldwide. It has a proven track record of protecting over 25% of the Fortune Global 500 companies, including four of the five largest banks and six of the world’s top ten telecommunications companies.

Leveraging technical prowess and innovation, NSFOCUS delivers a comprehensive suite of security solutions, including the Intelligent Security Operations Platform (ISOP) for modern SOC, DDoS Protection, Continuous Threat Exposure Management (CTEM) Service and Web Application and API Protection (WAAP). All the solutions and services are augmented by the Security Large Language Model (SecLLM), ML, patented algorithms and other cutting-edge research achievements developed by NSFOCUS.