CVEReports
Reports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Reports
  • Sitemap

Company

  • About
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Powered by Google Gemini & CVE Feed

|
•

CVE-2025-14847
CVSS 8.7|EPSS 77.17%

MongoBleed: The Heartbleed of Databases (CVE-2025-14847)

Alon Barad
Alon Barad
Software Engineer•December 19, 2025•5 min read
Active Exploitation
CISA KEV ListedRansomware Use

Executive Summary (TL;DR)

Dubbed 'MongoBleed', this vulnerability mimics the infamous Heartbleed bug. By sending a crafted compressed packet, an unauthenticated attacker can trick the server into treating uninitialized heap memory as valid data. When the parser inevitably chokes on the garbage data, it helpfully echoes it back in an error message, leaking sensitive secrets like admin credentials and session tokens.

A critical, unauthenticated heap memory disclosure vulnerability in MongoDB's wire protocol handling allows attackers to bleed secrets—including passwords and AWS keys—directly from server memory.

The Hook: Heartbleed, But for Your Database

If you thought we learned our lesson from OpenSSL's Heartbleed in 2014, you were wrong. CVE-2025-14847, affectionately nicknamed MongoBleed, brings that same chaotic energy to MongoDB. It is an unauthenticated remote memory disclosure vulnerability that affects the network transport layer of the database server.

Why is this terrifying? Because databases are the ultimate treasure chests of an infrastructure. They don't just hold data; they hold the keys to the data. When you bleed memory from a web server, you might get a session ID. When you bleed memory from a database process, you get connection strings, admin passwords, AWS secret keys, and fragments of queries from other concurrent users.

This isn't a complex ROP chain or a heap feng-shui masterpiece. It is a logic error so simple it hurts: the server trusts the client to tell it how big a buffer it needs, and then forgets to check if it actually filled that buffer with valid data before trying to read it.

The Flaw: Trust Issues in `OP_COMPRESSED`

The vulnerability lives in message_compressor_zlib.cpp, specifically within the handling of the OP_COMPRESSED opcode (2012). This opcode allows clients (drivers) to send compressed requests to save bandwidth. The header for this message includes a field called uncompressed_size.

Here is the logic failure: The server reads uncompressed_size from the packet header and immediately allocates a heap buffer of that size. It then decompresses the attached payload into this buffer. Crucially, the server code assumed that the decompression process would fill the entire buffer. It did not calculate the actual length of the decompressed bytes written.

If an attacker says "I have 8KB of data" but provides a compressed payload that only expands to 10 bytes, the server allocates 8KB, writes 10 bytes at the start, and leaves the remaining 8182 bytes exactly as they were on the heap. This trailing memory is full of "ghosts"—sensitive data left over from previous operations.

The Code: The One-Line Catastrophe

Sometimes the most devastating bugs are the shortest. The flaw boils down to the return value of the decompression helper function. It was returning the capacity of the buffer (which was trusted from user input) rather than the actual amount of data processed.

Below is the conceptual diff. In the vulnerable version, the code returns output.length(), which is the total size of the allocated vector. In the patched version, it returns length, which is the integer value returned by the zlib decompression routine indicating how many bytes were actually written.

// VULNERABLE CODE (Simplified)
// 'output' is a vector resized to the attacker-controlled 'uncompressed_size'
size_t length = decompress(input, output);
// The bug: We return the total buffer size, not the data size
return { output.length() }; 
 
// PATCHED CODE
size_t length = decompress(input, output);
// The fix: We return the actual amount of valid data
return length;

Because the function returned the full size, the caller (the BSON parser) assumed the entire buffer was valid BSON data. It would parse the 10 bytes of real data, and then continue blindly parsing the 8KB of uninitialized heap memory.

The Exploit: Weaponizing Error Messages

How do we get the data out? We don't need a side channel; MongoDB hands it to us on a silver platter. The exploit flow is brutally efficient:

  1. Connect: Open a TCP socket to the target MongoDB port (default 27017). No authentication is required.
  2. Lie: Send an OP_COMPRESSED message. Set the uncompressed_size to something large (e.g., 64KB). Set the payload to a valid zlib stream of just a few bytes (e.g., an empty BSON object {}).
  3. Trigger: The server expands the tiny payload into the massive buffer. The rest of the buffer is dirty heap memory.
  4. Extract: The server passes this buffer to the BSON parser. The parser reads the valid object, then continues reading the dirty memory. It inevitably hits junk data that violates BSON structure.
  5. Profit: The server throws an exception, usually InvalidBSON or Unrecognized field. Crucially, to be helpful, the error message often quotes the offending data. "Error: Field 'x\x00\xFFadmin_pass...' is not valid." That quoted string is your stolen memory.

The Impact: What's in the Box?

Since this is a heap leak, the contents are nondeterministic but highly sensitive. In a high-traffic database, the heap is constantly recycling memory used for authentication, query processing, and disk I/O.

Researchers and attackers exploiting this in the wild have recovered:

  • Cleartext Credentials: Passwords sent during authentication flows by other users.
  • Session Tokens: lsids (logical session IDs) which can be used to hijack active sessions.
  • Infrastructure Secrets: AWS Access Keys or API tokens stored in the DB or environment variables loaded into memory.
  • Data Fragments: Random JSON/BSON documents belonging to other customers in multi-tenant environments.

With CISA adding this to the KEV (Known Exploited Vulnerabilities) catalog in late 2025, it is confirmed that ransomware groups are using this to harvest credentials before deploying encryption payloads.

The Fix: Patch or Paralyze

The remediation is straightforward but urgent. MongoDB has released patches for all supported versions (from 4.4 to 8.2). If you are on an End-of-Life version like 3.6 or 4.0, you are out of luck—you must upgrade major versions or stay vulnerable.

If you cannot patch immediately (hello, enterprise change management boards), you have one kill-switch: Disable zlib.

This vulnerability is specific to the zlib compressor. You can edit mongod.conf to remove zlib from the allowed compressors list. This breaks the exploit chain completely without requiring a binary update, though it may increase network bandwidth usage slightly.

net:
  compression:
    compressors: snappy,zstd  # zlib removed

Official Patches

MongoDBOfficial MongoDB Security Alert

Fix Analysis (1)

Technical Appendix

CVSS Score
8.7/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
EPSS Probability
77.17%
Top 4% most exploited
45,000
Estimated exposed hosts via Shodan

Affected Systems

MongoDB Server 8.2.0 - 8.2.2MongoDB Server 8.0.0 - 8.0.16MongoDB Server 7.0.0 - 7.0.27MongoDB Server 6.0.0 - 6.0.26MongoDB Server 5.0.0 - 5.0.31MongoDB Server 4.4.0 - 4.4.29MongoDB Server 3.6, 4.0, 4.2 (All versions, EOL)

Affected Versions Detail

ProductAffected VersionsFixed Version
MongoDB Server
MongoDB Inc.
8.2.0 - 8.2.28.2.3
MongoDB Server
MongoDB Inc.
8.0.0 - 8.0.168.0.17
MongoDB Server
MongoDB Inc.
7.0.0 - 7.0.277.0.28
MongoDB Server
MongoDB Inc.
6.0.0 - 6.0.266.0.27
MongoDB Server
MongoDB Inc.
5.0.0 - 5.0.315.0.32
MongoDB Server
MongoDB Inc.
4.4.0 - 4.4.294.4.30
MongoDB Server
MongoDB Inc.
3.6, 4.0, 4.2None (EOL)
AttributeDetail
CWE IDCWE-200 (Exposure of Sensitive Information)
CVSS v4.08.7 (High)
Attack VectorNetwork (Unauthenticated)
EPSS Score77.17%
Exploit StatusActive / Weaponized
Componentmessage_compressor_zlib.cpp
ProtocolOP_COMPRESSED (2012)

MITRE ATT&CK Mapping

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1005Data from Local System
Collection
T1555Credentials from Password Stores
Credential Access
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor

The product exposes sensitive information to an unauthorized actor by sending it back in an error message or other response.

Exploit Resources

Known Exploits & Detection

MetasploitAuxiliary scanner module for MongoBleed
GitHubPython PoC to extract heap dumps
NucleiNuclei detection template
NucleiDetection Template Available

Vulnerability Timeline

Vulnerability Timeline

Vulnerability privately reported to MongoDB
2025-12-01
Patches released for supported versions
2025-12-15
Public PoC 'mongobleeder' released
2025-12-20
Added to CISA KEV Catalog
2025-12-29

References & Sources

  • [1]MongoDB JIRA Ticket (Restricted)
  • [2]CISA KEV Catalog

Subscribe to updates

Get the latest CVE analysis reports delivered to your inbox.

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.