CVE-2025-0938
Description
The Python standard library functions urllib.parse.urlsplit and urlparse accepted domain names that included square brackets which isn't valid according to RFC 3986. Square brackets are only meant to be used as delimiters for specifying IPv6 and IPvFuture hosts in URLs. This could result in differential parsing across the Python URL parser and other specification-compliant URL parsers.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Python's urllib.parse.urlsplit and urlparse incorrectly allowed square brackets in domain names, violating RFC 3986 and enabling potential SSRF due to parsing discrepancies.
Vulnerability
Description
Python's standard library functions urllib.parse.urlsplit and urlparse accepted domain names containing square brackets ([ and ]), which is not valid according to RFC 3986. Square brackets should only be used as delimiters for IPv6 and IPvFuture addresses in URLs. This bug allowed non-compliant hosts like prefix.[v6a.ip] to be parsed as valid, contrary to the specification [1][2][3][4].
Attack
Surface and Exploitation
An attacker could craft a URL with square brackets in the domain portion that is interpreted differently by Python's parser versus other specification-compliant parsers. This differential parsing could be exploited in scenarios where Python applications perform URL validation or routing based on host extraction. For example, a URL like http://[evil.com].trusted.com/ might be considered as host trusted.com by Python but evil.com.trusted.com by other parsers, potentially bypassing security controls [1].
Impact
Successful exploitation could lead to security bypasses such as server-side request forgery (SSRF), incorrect access control decisions, or phishing attacks, depending on how applications use the parsed hostname. The vulnerability has a CVSS base score of 5.3 (Medium), reflecting the moderate severity [CVE description].
Mitigation
The fix, introduced in CPython commits across versions (main, 3.13, 3.11, 3.10), now raises a ValueError when square brackets appear in domain names [1][2][3][4]. Users should update to patched versions: Python 3.13.x, 3.12.x, 3.11.x, and 3.10.x once the fixes are included in official releases. As a workaround, applications can validate URLs against RFC 3986 using alternative parsers before processing with Python's library.
- gh-105704: Disallow square brackets (`[` and `]`) in domain names for… · python/cpython@d89a5f6
- [3.13] gh-105704: Disallow square brackets (`[` and `]`) in domain na… · python/cpython@90e526a
- [3.11] gh-105704: Disallow square brackets (`[` and `]`) in domain na… · python/cpython@526617e
- [3.10] gh-105704: Disallow square brackets (`[` and `]`) in domain na… · python/cpython@b8b4b71
AI Insight generated on May 20, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected products
1- Range: v0.9.8, v0.9.9, v1.0.1, …
Patches
6a7084f6075c9b8b4b713c5f8526617ed68cdd89a5f6a6e65ff4e5c25666f90e526ae67b1Vulnerability mechanics
Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
11- github.com/python/cpython/commit/526617ed68cde460236c973e5d0a8bad4de896banvd
- github.com/python/cpython/commit/90e526ae67b172ed7c6c56e7edad36263b0f9403nvd
- github.com/python/cpython/commit/a7084f6075c9595ba60119ce8c62f1496f50c568nvd
- github.com/python/cpython/commit/b8b4b713c5f8ec0958c7ef8d29d6711889bc94abnvd
- github.com/python/cpython/commit/d89a5f6a6e65511a5f6e0618c4c30a7aa5aba56anvd
- github.com/python/cpython/commit/ff4e5c25666f63544071a6b075ae8b25c98b7a32nvd
- github.com/python/cpython/issues/105704nvd
- github.com/python/cpython/pull/129418nvd
- lists.debian.org/debian-lts-announce/2025/03/msg00013.htmlnvd
- mail.python.org/archives/list/security-announce@python.org/thread/K4EUG6EKV6JYFIC24BASYOZS4M5XOQIB/nvd
- security.netapp.com/advisory/ntap-20250314-0002/nvd
News mentions
0No linked articles in our index yet.