Skip to main content
CVE-2025-14847 High Patch Available

CVE-2025-14847: MongoDB Server -- Zlib Compressed Protocol Heap Memory Disclosure

CVE Details

CVE ID CVE-2025-14847
CVSS Score 7.5
Severity High
Vendor MongoDB
Product MongoDB Server
Patch Status Available
Published December 29, 2025
EPSS Score 83.0%
CISA Patch Deadline ⚠ January 19, 2026 Federal deadline passed

Background

MongoDB is one of the most widely deployed NoSQL document databases, used in cloud-native applications, enterprise software, and startup infrastructure alike. Its wire protocol supports multiple compression algorithms including Zlib, Zstd, and Snappy to reduce network overhead for high-throughput workloads.

CVE-2025-14847 is a vulnerability in MongoDB’s handling of Zlib-compressed protocol messages. An unauthenticated client can craft a Zlib-compressed message with inconsistent length parameters, causing the server to read and return uninitialised heap memory in its response. This is classified under CWE-130 (Improper Handling of Length Parameter Inconsistency).

CISA added this to the KEV catalog on 2025-12-29. Heap memory disclosure from a database server can expose query results, connection strings, authentication tokens, or memory addresses useful for ASLR bypass in follow-on exploitation.

Technical Mechanism

CWE-130 (Improper Handling of Length Parameter Inconsistency) occurs when the declared length in a protocol header does not match the actual payload length, and the server uses the declared (larger) length to allocate or read memory, accessing data beyond the actual payload.

// Conceptual vulnerable pattern in Zlib decompression handler
int decompress_message(const uint8_t *compressed, size_t compressed_len,
                       size_t declared_original_len) {
    uint8_t *output = malloc(declared_original_len); // allocate per declared length
    uLongf actual_len = declared_original_len;

    // Decompression fills output up to actual decompressed size
    uncompress(output, &actual_len, compressed, compressed_len);

    // Bug: uses declared_original_len instead of actual_len for response
    send_to_client(output, declared_original_len); // leaks uninitialized heap memory
    free(output);
    return 0;
}

By sending a message with declared_original_len larger than the actual decompressed size, the attacker causes the server to include uninitialized heap bytes in the response, leaking whatever data happened to be in that heap region.

Real-World Exploitation Evidence

CISA’s KEV listing confirms active exploitation. Heap memory disclosure from a database server can expose cached query data, BSON document fragments from other client sessions, connection metadata, or memory layout information. In multi-tenant or cloud deployments, heap leakage may expose data belonging to other tenants. Because the vulnerability requires no authentication, any client that can reach MongoDB’s default port (27017) is a potential attacker — including from the public internet on misconfigured instances.

Impact Assessment

  • Unauthenticated disclosure of server heap memory contents
  • Potential exposure of data from other database client sessions
  • Leaked memory addresses enabling ASLR bypass for follow-on exploitation
  • Information leakage that could expose authentication credentials or tokens in heap
  • Risk amplified in misconfigured publicly-accessible MongoDB instances

Affected Versions

ProductAffectedFixed
MongoDB ServerVersions prior to patch with Zlib compression enabledApply MongoDB patch release

Remediation Steps

  1. Update MongoDB to the patched version as specified in the MongoDB security advisory.
  2. As a temporary mitigation, disable Zlib compression in MongoDB configuration if not required.
  3. Ensure MongoDB is not accessible from the public internet — bind to localhost or internal IPs only.
  4. Implement network-level authentication requirements (firewalling port 27017).
  5. Enable MongoDB audit logging to detect anomalous pre-authentication connection activity.
  6. Review MongoDB access controls to enforce authentication requirements.

Detection Guidance

Log Sources: MongoDB server logs, network flow data, IDS/IPS.

IOCs: High volumes of unauthenticated connections to MongoDB port 27017; connections from unexpected IP addresses; Zlib-compressed OP_MSG requests with inconsistent length fields.

Suricata rule:

alert tcp $EXTERNAL_NET any -> $HOME_NET 27017 (
  msg:"ET EXPLOIT MongoDB Zlib Length Inconsistency CVE-2025-14847";
  flow:established,to_server;
  content:"|78 9c|"; offset:20;  /* Zlib magic bytes */
  threshold:type limit, track by_src, count 10, seconds 30;
  classtype:attempted-recon;
  sid:2099009; rev:1;
)

Timeline

DateEvent
2025-12CVE-2025-14847 disclosed by MongoDB
2025-12-29CISA adds to KEV catalog; active exploitation confirmed

References