Critical Vulnerability in Python Standard Library: URL Parsing Issue in urllib

python2.7 Updated 14 Dec 2025

Summary

31/01/2025
N/A
Yes i
Medium
6.3

UBUNTU-CVE-2025-0938: 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. Affects python2.7 versions < 2.7.6-8ubuntu0.6+esm28. Fixed in 2.7.6-8ubuntu0.6+esm28. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Python is a widely-used high-level programming language known for its readability and versatility. The urllib module in Python's standard library is essential for working with URLs, providing functions to parse, construct, and manipulate URLs. However, a recent vulnerability has been identified in the urlsplit and urlparse functions, which could lead to improper URL parsing, potentially affecting applications that rely on these functions for URL handling.

Vulnerability Detail

The vulnerability arises from the acceptance of domain names containing square brackets in the urllib.parse.urlsplit and urlparse functions, which is not compliant with RFC 3986. This non-compliance can lead to differential parsing between Python's URL parser and other specification-compliant parsers, resulting in unexpected behavior or security issues in applications that handle URLs. The implications of this vulnerability could range from incorrect URL handling to potential security risks if malicious URLs are processed incorrectly.

How To Fix

Minimum fixed version

2.7.6-8ubuntu0.6+esm28

This is the first release that contains the fix.

sudo apt-get install --only-upgrade python2.7

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, developers can implement input validation to ensure that URLs do not contain square brackets before processing them with the urlsplit or urlparse functions. This can be done using regular expressions to filter out invalid URLs.

Conclusion

In summary, the vulnerability in Python's urllib module poses significant risks due to improper URL parsing. It is crucial for developers to update their packages to the patched versions and implement necessary workarounds to ensure the security and reliability of their applications.

See every vulnerability recorded for python2.7 →

Share this vulnerability

FAQ

The vulnerability allows the urllib.parse.urlsplit and urlparse functions to accept invalid domain names containing square brackets, leading to potential security risks.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without requiring any signup.

The consequences may include incorrect URL parsing, unexpected application behavior, and potential security risks if malicious URLs are processed.

Yes, patched versions of the affected Python packages are available. It is recommended to update to these versions to mitigate the vulnerability.

If immediate updates are not possible, implement input validation to filter out invalid URLs as a temporary workaround.

Related vulnerabilities

Recent vulnerabilities recorded for python2.7.

How To Fix

Minimum fixed version

2.7.6-8ubuntu0.6+esm28

This is the first release that contains the fix.

sudo apt-get install --only-upgrade python2.7

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback