Unauthenticated MongoDB enumeration, compression enumeration and CVE-2025-14847 triage in a single dependency-free Python file.
Unauthenticated MongoDB enumeration, compression enumeration and
CVE-2025-14847 triage, in a single dependency-free Python file.
cve-2025-14847-scanner.py finds MongoDB servers, fingerprints them over the
wire protocol, enumerates what an anonymous client can reach — admin commands
and network compression — and flags versions affected by CVE-2025-14847.
Three facts make this CVE worth a purpose-built scanner:
The version is public. buildInfo requires no privileges, so anyone
who can reach the port learns the exact release. That is enough to match
against the advisory.
The attack surface is the zlib decompressor. CVE-2025-14847 is a
decompression-bomb denial of service in MongoDB's zlib network-compression
path. Whether a server accepts zlib frames matters as much as its version:
a server in an affected range that accepts zlib frames is the worst case,
and a server that rejects them is not reachable by this vector even if its
version is in range.
The instance may be wide open. A misconfigured deployment answers
listDatabases, serverStatus or even getLog to an anonymous client.
Those commands normally require privileges, so their success is direct
evidence that authorization is not being enforced.
Python 3.7 or newer. Standard library only — no pip install, no pymongo,
no nmap required.
Read-only against targets at all times.
# comma-delimited targets
python3 cve-2025-14847-scanner.py --targets "db01.example.com,db02.example.com:27018"
# line-delimited target file
python3 cve-2025-14847-scanner.py --input-file targets.txt
# nmap output file (any of -oX / -oN / grepable; auto-detected)
python3 cve-2025-14847-scanner.py --nmap-input-file scan.xml
# well-known MongoDB ports on every target, plus replica set discovery
python3 cve-2025-14847-scanner.py --input-file targets.txt --ports known --discover
# reports
python3 cve-2025-14847-scanner.py --input-file targets.txt --json report.json --csv report.csv
# verify the codec and framing any time
python3 cve-2025-14847-scanner.py --self-test
Run --help for examples, the affected-version table and the advisory
summary — the section headers are colour-highlighted in a terminal.
HOST PORT STATUS SERVICE RSET ROLE VERSION WIRE ADVERTISED ZLIB VERDICT AUTH
db1 27018 ok mongod rs0 PRIMARY 7.0.14 21 zlib,snappy ACTIVE VULNERABLE AUTH ENFORCED
db2 27017 ok mongod rs0 SECONDARY 8.0.29 25 zlib,snappy no NOT VULNERABLE AUTH ENFORCED
db3 27017 ok mongod - STANDALONE 8.0.6 25 - ACTIVE VULNERABLE AUTH NOT ENFORCED
ADVERTISED is what the server named in its hello reply; ZLIB is the result
of the active frame test. They can disagree — db3 advertises nothing but
still accepts zlib frames — and when they do, ZLIB is the operative signal
(see Compression enumeration).
In a terminal, VULNERABLE, AUTH NOT ENFORCED and ZLIB ACTIVE render in
red; NOT VULNERABLE, AUTH ENFORCED and zlib: not accepted render in
green; inconclusive values render in yellow. Colour is disabled automatically
when output is not a terminal, when --color never is passed, or when the
NO_COLOR environment variable is set.
Three ways in, all combinable — there are no positional arguments:
| Source | Flag | Notes |
|---|---|---|
| Comma-delimited string | --targets LIST | Same grammar as the file; repeatable |
| Line-delimited file | --input-file FILE | One target per line; # comments and blank lines ignored; repeatable |
| nmap output | --nmap-input-file FILE | -oX, -oN and grepable formats auto-detected; repeatable |
Target grammar (--targets items or --input-file lines): host,
host:port, host port, or a CIDR (expanded to individual addresses, capped
at a built-in 1024-address limit).
nmap output that includes -sV results or --script mongodb-info output is
used as a version fallback: if the wire probe cannot obtain a version (for
example buildInfo is auth-blocked), the version nmap found is used and
marked version_source: nmap scan. Port state is always read explicitly from
the scan output (the <state> element or the state field), never inferred.
--ports known expands every target across MongoDB's well-known ports:
27017-27020, 28017, 37017, 47017, 57017.
CVE-2025-14847 lives in MongoDB's zlib decompression path, so the scanner
checks compression support two ways and reports them in two separate columns:
ADVERTISED — handshake advertisement. The hello/isMaster command
accepts a compression array. The server replies with a compression
field listing the algorithms it supports. The scanner iterates the
candidates (zlib, snappy, zstd) one at a time and records which each
server acknowledges. This describes what the server will use to compress
its outgoing messages.
ZLIB — active zlib frame test. Advertised support is not proof that
the server decompresses zlib frames. The scanner negotiates zlib, then
sends one OP_COMPRESSED frame containing a zlib-compressed ping. A
correct reply proves the server accepts zlib frames — the actual
CVE-2025-14847 vector. Only zlib can be frame-tested with a stdlib-only
build; snappy and zstd are detected via the handshake advertisement.
The two columns can legitimately disagree. A server can decline to advertise
zlib (so it never compresses its own replies with it) while still accepting
and decompressing zlib frames from a client — the advertised list governs the
outgoing compressor, while the frame test exercises the incoming decompressor.
When they disagree, ZLIB is the operative signal for this CVE and
ADVERTISED is context. The detail section prints both side by side, for
example advertised: none zlib: ACCEPTED (OP_COMPRESSED zlib frame).
Reading the ADVERTISED column:
| Value | Meaning |
|---|---|
zlib,snappy (etc.) | Compressors the server listed in its hello reply |
- | Nothing advertised. This does not mean zlib frames are rejected — check the ZLIB column. |
Reading the ZLIB column:
| Value | Meaning |
|---|---|
ACTIVE (red) | The server accepted a zlib-compressed frame. With an affected version, the CVE-2025-14847 vector is reachable. |
advertised (yellow) | zlib is listed in the handshake but the frame test was skipped or inconclusive. |
no (green) | zlib is neither advertised nor accepted. The version may still be in range, but this vector is not reachable. |
Interpretation with the version verdict:
VULNERABLE + zlib ACTIVE — highest priority. Patch, or remove zlib from
net.compressors as an interim measure. This holds whether or not zlib was
advertised: acceptance is what the frame test proves.
VULNERABLE + zlib not detected — version in range, vector not
reachable. Patching is still required.
NOT VULNERABLE + zlib ACTIVE — patched; zlib acceptance is expected.