Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
MongoBleed-exploit — MongoBleed (CVE-2025-14847) Lab & PoC : A complete educational environment to reproduce the critical unauthenticated memory leak in MongoDB. Includes a vulnerable Docker container with multi-database seeding (PII, API keys) and a Python exploit to demonstrate data extraction. Ideal for security research and awareness. 1-day analysis. | Kitploit
Tools/GitHubGitHub/eljoamy/mongobleed-exploit
Memory ForensicsVulnerability AnalysisExploitationCTFPenetration TestingLearning & EducationDatabase SecurityLabs & Practice

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →

About

MongoBleed (CVE-2025-14847) Lab & PoC : A complete educational environment to reproduce the critical unauthenticated memory leak in MongoDB. Includes a vulnerable Docker container with multi-database seeding (PII, API keys) and a Python exploit to demonstrate data extraction. Ideal for security research and awareness. 1-day analysis.

GitHub
eljoamy/mongobleed-exploit

MongoBleed-exploit

View Repository
98 months agoNot yet reviewed
Share

CVE-2025-14847: MongoBleed Laboratory

Python      MongoDB      Docker

Table of Contents

  1. Introduction
  2. Vulnerability Details
    • How it Works
  3. Impact
  4. Lab Architecture
  5. Prerequisites
  6. Installation and Usage
    • 1. Start the Environment
    • 2. Install Dependencies
    • 3. Verify Lab Setup (Optional)
    • 4. Run the Exploit
  7. Exploitation Walkthrough
  8. Remediation
  9. License
  10. Disclaimer
  11. References
  12. Author

Introduction

This laboratory is designed to reproduce and analyze MongoBleed (CVE-2025-14847), a critical vulnerability in MongoDB. This flaw allows unauthenticated attackers to read sensitive data from the server's memory due to improper handling of compressed messages.

The environment includes a vulnerable MongoDB instance populated with dummy sensitive data (PII, API keys, financial records) to demonstrate the severity of the leak.

Vulnerability Details

CVE ID: CVE-2025-14847
Name: MongoBleed
Component: Wire Protocol (OP_COMPRESSED)
Vulnerable Versions: MongoDB 6.0.x < 6.0.27, 7.0.x < 7.0.28, 8.0.x < 8.0.17 (and others) URL: Click on it -> NVD CVE-2025-14847

How it Works

The vulnerability resides in the way MongoDB handles OP_COMPRESSED messages using the zlib compression algorithm.

  1. Size Mismatch: An attacker sends a compressed message where the uncompressed_size field in the header is intentionally set to a value much larger than the actual decompressed data size.
  2. Memory Allocation: The server allocates a memory buffer based on this inflated uncompressed_size.
  3. Partial Write: The zlib decompressor writes the actual (small) payload to the beginning of this buffer. The rest of the buffer remains uninitialized, containing residual data from previous operations (RAM artifacts).
  4. The Leak: When the server attempts to parse this buffer as a BSON document, it reads past the valid data into the uninitialized memory. If the parser encounters an error (which is likely), it may return the "bad" data in the error message to the client.

Impact

  • Unauthenticated Access: The attack does not require valid credentials.
  • Information Disclosure: Attackers can extract anything currently in the MongoDB process memory, including:
    • Authentication credentials (cleartext passwords or hashes).
    • Data from other databases/collections.
    • Server configuration and environment variables.
    • Active session tokens.

Lab Architecture

The lab consists of:

  • Vulnerable Service: MongoDB 6.0.10 (Docker container).
  • Authentication: Enabled (admin / secretpassword).
  • Data Seeding: An initialization script (init-mongo.js) that populates 3 distinct databases to simulate a real Cloud Infrastructure SaaS environment:
    • dbmongotesting: Core infrastructure data.
      • compute_instances: Sensitive metadata (User Data scripts, API keys).
      • deployment_secrets: High-value targets (K8s tokens, CI/CD keys, Slack webhooks).
    • identity_provider: User identity management.
      • users: User credentials, password hashes (Argon2), and MFA backup codes (leaked in plain text).
    • system_audit: Logs and monitoring.
      • query_logs: Contains historical queries, some including leaked credentials (e.g., AWS keys).
  • Exploit: A Python script (exploit.py) implementing the reverse-engineered protocol attack.

Prerequisites

  • Docker
  • Docker Compose
  • Python 3

Installation and Usage

1. Start the Environment

Launch the vulnerable container. This will automatically create the databases and populate them with data.

root@kitploit:~
docker-compose up -d

Wait about 10-15 seconds for the database to initialize and load the data.

Note: If you have run this lab before, ensure you reset the volume to load the latest data structure:

root@kitploit:~
docker-compose down -v
docker-compose up -d

2. Install Dependencies

You can install the required dependencies using pip with the legacy requirements.txt or the modern pyproject.toml.

Option A: Using requirements.txt (Standard)

root@kitploit:~
pip install -r requirements.txt

Option B: Using pyproject.toml (Modern) This will install the project and its dependencies in the current environment.

root@kitploit:~
pip install .

3. Verify Lab Setup (Optional)

We have provided a verification script to ensure the database is reachable and the data has been seeded correctly.

root@kitploit:~
python verify_lab.py

This script uses the admin credentials to check the existence of databases like sensitive_db, legacy_crm, etc.

4. Run the Exploit

Execute the Python script to attack the server. No credentials are required for this step, demonstrating the unauthenticated nature of the vulnerability.

root@kitploit:~
python exploit.py --host localhost --port 27017 --min 100 --max 5000

Exploitation Walkthrough

The script performs the following steps:

  1. Constructs a malicious BSON payload.
  2. Compresses it and wraps it in an OP_COMPRESSED header with a faked, inflated size.
  3. Sends it to the target server.
  4. Listens for error responses.
  5. Prints any readable text found in the server's response (which comes from the memory leak).

Expected Output: You should see output indicating leaks found at various offsets, followed by a summary of detected secrets.

root@kitploit:~
[*] MongoBleed Exploit (Custom Implementation)
[*] Target: localhost:27017
[*] Scanning memory offsets 100 to 5000...
[+] Offset 120  | ... dbmongotesting ... compute_instances ...
[+] Offset 145  | ... field name 'AKIAIOSFODNN7EXAMPLE' is not valid ... [!] FOUND AKIA
[+] Offset 210  | ... "token": "eyJhbGciOiJSUzI1NiIsImtpZCI6Ik16UTBOVFZ... [!] FOUND token

[*] Scan completed in 12.45s
[*] Total bytes leaked: 4502
[*] Unique fragments: 156

[*] Secrets Summary:
[!] Found pattern: AKIA
[!] Found pattern: token
[!] Found pattern: password

Remediation

To fix this vulnerability in production environments:

  1. Upgrade: Update MongoDB to a patched version (e.g., 6.0.27+, 7.0.28+, 8.0.17+).
  2. Network Restrictions: Ensure MongoDB ports (27017) are not exposed to the public internet.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Disclaimer

This material is for educational and research purposes only. Do not use this exploit on systems you do not own or have explicit permission to test. The author is not responsible for any misuse of this information or tool.

References

  • Exploiting an Exposed MongoDB Instance with Mongobleed: A Local Lab Walkthrough
  • CVE-2025-1623

Author

ElJoamy
Joseph Meneses (ElJoamy)

Backend and AI Developer · Cybersecurity Engineer · DBA · Penetration Tester

Download Tool