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

Advisory record · `GHSA-vp6j-j7w5-5xjj`

- **Identifiers:** `GHSA-vp6j-j7w5-5xjj` · `CVE-2026-96748` · `PYSEC-2026-4297`
- **State:** Confirmed
- **Severity:** CVSS 8.3 High
- **Critical:** No
- **Weakness (CWE):** [CWE-177](https://cwe.mitre.org/data/definitions/177.html)
- **Tags:** [CWE-177](https://agentprime.io/advisories/tag/cwe-177.md)
- **Published:** 5 Oct 2026
- **Updated:** 15 Oct 2026
- **Reviewed by a person:** No

Published by the GitHub Advisory Database at 5 Oct 2026, 23:47 UTC. agentprime has not analysed this yet, so whether it affects any app is not known.

## Affected packages

- `pymongo` (PyPI): affected `>=3.5.0, <4.18.2`; fixed in `4.18.2`

## Machine-written summary

Summary written by Claude Haiku from the source advisory. Not reviewed by a person.

> PyMongo versions from 3.5.0 before 4.18.2 are vulnerable. The driver percent-decoded the whole host section of a connection string before splitting it into host and port entries, so a percent-encoded comma or colon in a hostname could add an extra attacker-chosen host to the seed list. An attacker who can influence untrusted input placed into a connection string could cause the client to contact their server, potentially exposing credentials. Upgrade to PyMongo 4.18.2. Do not put untrusted input into the host portion of a connection string.

Written 1 Nov 2026.

## Not analysed yet

We haven’t published our analysis of this Advisory yet. Once a person has reviewed it, this page will say what’s vulnerable, what has to be true for your app to be affected, and how to check.

## Severity and exploitation

- 8.3 High, CVSS 4.0: `CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:H/VA:N/SC:N/SI:N/SA:N`, from CNA (mongodb)

- **CISA KEV:** Not listed.
- **EPSS:** 0.0036, the 30th percentile, on 5 Nov 2026: FIRST’s estimate of the chance of exploitation in the next 30 days.

## Timeline

- 31 Oct 2026, 14:08 UTC: First seen by agentprime
- 31 Oct 2026, 14:08 UTC: [Confirmed by OSV](https://osv.dev/vulnerability/GHSA-vp6j-j7w5-5xjj)

## Sources

- [GitHub Advisory Database: GHSA-vp6j-j7w5-5xjj](https://github.com/advisories/GHSA-vp6j-j7w5-5xjj)
- [OSV: GHSA-vp6j-j7w5-5xjj](https://osv.dev/vulnerability/GHSA-vp6j-j7w5-5xjj)
- <https://github.com/mongodb/mongo-python-driver/security/advisories/GHSA-vp6j-j7w5-5xjj>
- <https://nvd.nist.gov/vuln/detail/CVE-2026-96748>
- <https://github.com/mongodb/mongo-python-driver/pull/3066>
- <https://github.com/mongodb/mongo-python-driver/commit/1e7a56db4649b14c4c9a6ac20aa4a8d0d1bb238a>
- <https://github.com/mongodb/mongo-python-driver/commit/640dd2383a1a2fb1a10e5222d50ebc0b22a61bd7>
- <https://github.com/mongodb/mongo-python-driver>
- <https://github.com/mongodb/mongo-python-driver/blob/4.18.2/doc/changelog.rst>
- <https://github.com/mongodb/mongo-python-driver/releases/tag/4.18.2>
- <https://www.mongodb.com/community/forums/t/pymongo-4-18-2-released/343732>

Facts on this page come from the GitHub Advisory Database (CC-BY 4.0), OSV and the other sources listed, as published. We don’t reproduce full advisory descriptions, which can contain exploit code.

## Check whether this affects you

A Match means an installed version is in the affected range above. Most don’t affect the app; agentprime hasn’t analysed this one yet.

- With the agentprime MCP server (<https://api.agentprime.io/mcp>), ask your agent to check the project: `check_lockfile` sends a lockfile, `check_packages` a list of installed packages, and both return the Matches and the upgrades that clear them. `get_advisory` returns this record. Setup: <https://agentprime.io/mcp.md>
- In a browser: <https://agentprime.io/check/> reads your lockfile in the browser, never uploading it.
- Whether it touches your code, with file and line: the Claude Code plugin, <https://agentprime.io/plugin.md>
- As JSON: <https://api.agentprime.io/v1/advisories/GHSA-vp6j-j7w5-5xjj>, or `POST https://api.agentprime.io/v1/match` with your packages (<https://agentprime.io/api.md>)

---

The web page: <https://agentprime.io/advisories/GHSA-vp6j-j7w5-5xjj/>. Everything for agents: <https://agentprime.io/llms.txt>.
