Information Exposure Affecting mongodb package, versions >=4.0.0-beta.0 <7.9.1


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.13% (2nd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Information Exposure vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-JS-MONGODB-22958515
  • published25 Nov 2026
  • disclosed19 Nov 2026
  • creditUnknown

Introduced: 19 Nov 2026

NewCVE-2026-129930  (opens in a new tab)
CWE-209  (opens in a new tab)

How to fix?

Upgrade mongodb to version 7.9.1 or higher.

Overview

mongodb is an official MongoDB driver for Node.js.

Affected versions of this package are vulnerable to Information Exposure in the HostAddress class in utils.ts and the parseOptions function in connection_string.ts, which include connection-string components in the messages and cause of errors thrown during MongoClient construction and connection. An attacker with access to the application's logs can obtain database credentials when the application passes a connection string with credentials but no valid host, because the user:pass portion is parsed as host:port and appears in the resulting Unable to parse ... with URL error and its cause.input. This affects only applications that build connection strings from user or configuration input where a missing or malformed host can reach the driver, and that log driver errors or MongoClient instances.

Workaround

This vulnerability can be avoided by validating that connection strings contain a host before passing them to the driver, and by redacting the message and cause of errors raised during MongoClient construction or connection before logging them.

CVSS Base Scores

version 4.0
version 3.1