
CVE-2025-14847 explaination and lab
Reference CVE : CVE-2025-14847
This repository is an educational lab that demonstrates the concept behind a class of issues often described as “compression framing / size-metadata memory disclosure” in database wire protocols.
It is written to support defensive understanding: how MongoDB network compression is negotiated and framed, why size fields matter, and how robust parsers prevent unintended memory exposure.
Note on CVE reference: This lab is framed around the idea referenced as CVE-2025-14847 . This repo does not validate, reproduce, or exploit a specific vendor bug or claim that any particular MongoDB version is affected. It focuses on the general failure mode (mismatched size metadata around compressed payloads) and the mitigations.
This repository does not include (and should not be used as) evidence of which MongoDB versions are vulnerable or patched for any specific CVE.
To document “vulnerable” vs “patched” versions correctly for a report, use an official vendor advisory / release notes for the CVE and cite it.
Practical steps to verify what you are running:
docker compose exec mongodb mongod --versiondocker compose exec mongodb mongosh --quiet --eval "db.version()"mongod --versionmongosh --quiet --eval "db.version()"If you share the advisory link you’re using, I can format a clean “Affected / Fixed” table in the README without guessing.
This lab illustrates a compression framing / size-metadata mismatch failure mode:
OP_COMPRESSED envelope adds more size fields (outer message length, declared uncompressed size, and the inner message’s own length).See protocol_overview.md for the detailed framing walkthrough.
By the end of the lab, you should be able to:
It does:
hello including compression: ["zlib"]OP_COMPRESSED message using zlibIt does NOT:
docker-compose.yml – Runs a MongoDB container with zlib compression enabled and localhost-only exposure.protocol_overview.md – Wire protocol + BSON + compression workflow + conceptual vulnerability explanation.mitigation.md – Defense guidance: patching, config, and detection ideas.lab_probe.py – Original probe that negotiates compression and logs message sizes safely.From this repo directory:
docker compose up -d
Confirm it’s running:
docker compose ps
python .\lab_probe.py
Expected output:
hellohello and logs both compressed and decompressed message sizespython .\lab_probe.py --toy-demo
This runs only local parsing checks to illustrate why size validation matters.
docker compose down
127.0.0.1:27017 on the host.