‹ Back to Blog

The MongoDB CVE That Leaks Credentials Into Your Logs

Engineering

Most security advisories ask you to patch a bug in your running code. This one is different: by the time you read it, the damage may already be sitting in your error tracker and your log storage, in cleartext. MongoDB’s Node.js driver shipped v7.9.1 on November 19th to fix two CVEs, and one of them is squarely an observability problem. If you run MongoDB from Node and you capture errors or logs anywhere — which, with Scout’s error monitoring and log management, you do — this is worth ten minutes today.

Two CVEs, One That Follows You Into Your Logs

The patch closes two separate issues. The first, CVE-2026-129929, is narrow: a NUL character inside PLAIN authentication credentials could change which identity the server actually authenticates, because NUL is the field separator in the PLAIN message. The driver now throws from the MongoClient constructor before any auth command goes out, so a NUL in a username or password fails fast instead of silently resolving to the wrong identity. If you use PLAIN (typically LDAP), upgrade and move on.

The second one, CVE-2026-129930, is the one that should make you pause. On every version from 4.0.0 up to 7.9.1, values from your connection string — including credentials — could appear in cleartext in two places: the text of errors the driver throws, and the logged representation of the client object itself. That is a wide version range and a long time for the bug to have been quietly exfiltrating secrets into exactly the systems built to retain them.

Why A Parsing Bug Becomes A Credentials Leak

Here is the mechanism, because it matters for where you go looking. When the driver failed to parse a connection string, it put the offending input into the error. A malformed URI like mongodb://user:pa55word would throw something along the lines of Unable to parse user:pa55word with URL — password included. Separately, logging the client or its options could serialize the raw connection string.

Neither of those is dangerous on its own. They become dangerous because of what happens next in a well-instrumented app: the error gets caught and reported to your error tracker, or the client gets logged at startup and shipped to your log pipeline. The secret leaves the process and lands in durable storage, searchable, often with generous retention. The better your observability, the more thoroughly the credential got captured. That is an uncomfortable irony, and it is the whole point of this post.

In 7.9.1 the driver enforces a limited-trust policy for what it will print:

  • An invalid option value is no longer echoed back. The option is named using the driver’s own internal spelling, so Expected maxPoolSize to be stringified int value instead of repeating your input.
  • An unsupported option is reported by its position in the string, not by the name you wrote: connection string contains unsupported options, at position: 2.
  • A host that cannot be parsed is dropped from the error and its cause: Unable to parse host with URL, with the user:pa55word part gone.

Upgrading stops the bleeding. It does not clean up what already leaked.

What To Actually Do This Week

Patching is step one, not the finish line. Here is the full sequence.

Upgrade the driver to 7.9.1 across every Node service that talks to MongoDB. This stops new leaks.

Search your error and log history for connection strings that already made it in. The thing you are hunting for is a literal mongodb:// or mongodb+srv:// with credentials in front of the @. This is exactly the kind of retrospective search error monitoring and log management are for — point a query at your captured errors and your log store and look for the pattern across the full retention window, not just today.

Rotate anything you find. A credential that reached your log pipeline should be treated as exposed, even if the storage is private. Rotate the MongoDB user’s password, and assume anyone with read access to your observability tooling could have seen it.

Keep credentials out of exceptions going forward. Pass your username and password through the driver’s auth option instead of embedding them in the connection string URI, so a future parse error has nothing sensitive to echo. And avoid logging the MongoClient or its options object wholesale.

One More Thing: Your Error Groups Will Shift

There is a quieter operational side effect worth flagging before it pages someone. Because the text of these errors changed, any alerting or grouping you have keyed on MongoDB error message strings will behave differently after the upgrade. Error trackers that fingerprint on message text may create fresh groups for errors that used to fold together, and a dashboard that counts a specific error string may suddenly read zero. That is expected — just know it is the upgrade talking, not a new incident, and re-point any brittle string-match alerts at the new wording.

This is the sort of thing that is obvious in hindsight and invisible in the moment, which is the entire case for good monitoring. A CVE like this turns your observability stack into both the place a secret leaked and the place you find it again. Scout gives you the error history and the searchable logs to run that check in minutes, plus the traces to confirm nothing downstream broke when the error text changed. Get started with Scout for free, connect your Node app, and go see what your logs have been quietly keeping.

For application monitoring with errors, logs, and traces, Scout Monitoring provides the fastest insights without the bloat.