Skip to content
Info disclosure Write-up Intermediate

MongoDB Hacked: MongoBleed CVE-2025–14847

MongoDB trusted a client-supplied uncompressed message size when decompressing zlib-compressed wire protocol messages, allocating a buffer larger than the actual decompressed data. By sending a small compressed message with an inflated declared size and malformed BSON lacking a null terminator, an attacker could cause an error response to include uninitialised heap memory, leaking credentials, tokens and other sensitive data without authentication.

medium.com

Published on medium.com

When I look at most CVEs or exploits, I see complicated explanations. Bytecode tricks.

Muhammad Haider Tallal, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the server allocated a buffer based on the client-declared uncompressed size and then returned the whole buffer in an error response instead of only the actual decompressed data.

Impact

An attacker could leak uninitialised heap memory containing database credentials, plain text passwords, cloud provider keys, session tokens and customer data; the text notes that instances behind a firewall are not exploitable.

What the attacker needed

Network access to the MongoDB instance; No firewall blocking the port; No authentication required

How it was found

  1. Send a compressed message that expands to a small size but declare a much larger uncompressed size.
  2. Include malformed BSON in the payload that omits a null terminator.
  3. Trigger a parsing error so MongoDB returns the entire allocated buffer, including uninitialised memory.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

MongoDB is a database that can compress messages to save bandwidth. When a client sends a compressed message, it also says how big the message will be after decompression. MongoDB believed that number and reserved that much memory, but only filled part of it with the real data. The rest was old memory from other operations, and an error message sent that leftover memory back to the attacker.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.