CVE-2026-96748
JSON

8.3high

Connection redirection via percent-encoded delimiter injection in connection string hosts

Severity
8.3high CVSS:4.0 by mongodb
Exploit likelihood
0.36% (higher than 31% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
mongodb
Also known as
GHSA-vp6j-j7w5-5xjjPYSEC-2026-4297

Description

PyMongo's connection string parsing decodes percent-encoded characters in the host portion before the host list is separated on its delimiters. When an application places a hostname value supplied by an unauthenticated party into a connection string, that party may cause additional servers of their choosing to be added to the application's database client. The application may then send its authentication exchange and database operations to one of those servers, which can observe limited information and return altered results.

Affected

Product or packageVersionsReported by
MongoDB Python Driverbefore 4.18.2CVE List
pymongo (PyPI)from 3.5.0 before 4.18.2GitHub Advisory Database, PyPA Advisory Database

All scores

mongodb8.3high CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:H/VA:N/SC:N/SI:N/SA:N
mongodb6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N
GitHub6.5high CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N
GitHubhigh CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:H/VA:N/SC:N/SI:N/SA:N
PyPA Advisory Database6.5medium CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N
PyPA Advisory DatabaseNot scored CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:H/VA:N/SC:N/SI:N/SA:N

Classification

CWE-177

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

PyMongo's connection string parsing decodes percent-encoded characters in the host portion before the host list is separated on its delimiters. When an application places a hostname value supplied by an unauthenticated party into a connection string, that party may cause additional servers of their choosing to be added to the application's database client. The application may then send its authentication exchange and database operations to one of those servers, which can observe limited information and return altered results.

GitHub Advisory Database
Summary

PyMongo percent-decoded the entire host section of a connection string before splitting it into individual host:port entries. A percent-encoded , or : in a hostname therefore decoded into a real delimiter, injecting an additional attacker-chosen host and port into the client's seed list.

Impact

An application that interpolates untrusted input into a MongoDB connection string -- for example, a tenant name or hostname fragment taken from a request -- could be made to add an attacker-controlled server to the seed list. Because %2C and %3A survive most URL-safety checks and only become delimiters inside PyMongo's parser, input that looks like a single hostname to the application becomes two hosts to the driver. The client may then perform topology discovery and authentication against the attacker's host, exposing credentials, or route operations to it.

Unix domain socket paths, the only host identifiers that legitimately require percent-encoding, are not affected.

Patches

Fixed in PyMongo 4.18.2. Percent-decoding was moved into split_hosts and now applies only to Unix domain socket paths, identified by an unescaped .sock suffix before decoding, and only after splitting on ,.

Workarounds

Do not interpolate untrusted input into the host portion of a connection string. If unavoidable, reject or percent-decode-and-validate the value before building the URI.

Details

The decoding was introduced in PyMongo 3.5.0 (PYTHON-1282), where unquote_plus was applied to the whole host section in _validate_uri and, later, _parse_srv, before the string was split on , and :.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-96748 changed 2026-09-24CVE Terms of Use
GitHub Advisory DatabaseGHSA-vp6j-j7w5-5xjj changed 2026-10-15CC-BY-4.0
NVDCVE-2026-96748 changed 2026-09-24Public domain
PyPA Advisory DatabasePYSEC-2026-4297 changed 2026-10-15CC-BY-4.0