Alta

PyMongo: PYTHON-5986 Host injection in PyMongo connection string parsing via percent-encoded delimiters

  • Publicada: 05.10.2026
  • Actualizado: 15.10.2026 18:17

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 :.

Software afectado

Haz clic en una tecnología para ver todas sus vulnerabilidades.

PlataformaPaqueteVersiones vulnerablesCorregida en
Python (PyPI) pymongo >= 3.5.0, < 4.18.2 4.18.2

Referencias

Puntuación CVSS 6.5/10
Vector CVSS
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:H/A:N
Debilidad (CWE)
CWE-177
Plataforma
Python (PyPI)
Paquete
pymongo
Publicada
05.10.2026
Actualizado
15.10.2026 18:17

Fuentes y licencias

OSV / GitHub Advisory Database - PYSEC-2026-4297 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - GHSA-vp6j-j7w5-5xjj - CC BY 4.0

Historial de vulnerabilidades: pymongo

Todas las vulnerabilidades publicadas de este paquete (Python (PyPI)), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.

Entradas en total
6
Primera → última
08.2013 10.2026
Sin corrección
0
Explotada en ataques
0

Distribución por gravedad

  • Alta 2
  • Media 4

Divulgaciones por año

  1. 2017: 0
  2. 2018: 0
  3. 2019: 0
  4. 2020: 0
  5. 2021: 0
  6. 2022: 0
  7. 2023: 0
  8. 2024: 1
  9. 2025: 0
  10. 2026: 4

antes: 1

  1. PyMongo: PYTHON-5986 Host injection in PyMongo connection string parsing via percent-encoded delimiters esta entrada
    Alta · 6.5 CVE-2026-96748 >= 3.5.0, < 4.18.2 4.18.2
  2. Media · 4.7 CVE-2024-5629 < 4.6.3 4.6.3

Identifica las vulnerabilidades de tu aplicación

Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.

Conectar tu aplicación
Newsletter DockRay

La seguridad de tus aplicaciones en tu correo

Vulnerabilidades importantes, recomendaciones concretas y consejos prácticos para tus aplicaciones. Elige tus tecnologías y sigue lo que importa para tu proyecto.

  • Un resumen diario de nuevas vulnerabilidades, también las críticas.
  • Avisos sobre actualizaciones importantes.
  • Consejos prácticos sobre seguridad y monitorización de aplicaciones.

Déjalo vacío para recibir avisos de todas las tecnologías.

Suscripción gratuita. Date de baja con un clic en cualquier correo.