CVE-2019-9636

9.8 CRITICAL

📋 TL;DR

This vulnerability in Python's urllib.parse module allows attackers to craft URLs that appear to belong to one domain but are parsed as another due to Unicode encoding issues during NFKC normalization. This can cause sensitive information like cookies and authentication credentials to be sent to unintended hosts. Affected are Python applications using urllib.parse.urlsplit or urlparse with Python versions 2.7.x through 2.7.16 and 3.x through 3.7.2.

💻 Affected Systems

Products:
  • Python
  • Applications using Python's urllib.parse module
Versions: Python 2.7.x through 2.7.16 and 3.x through 3.7.2
Operating Systems: All operating systems running affected Python versions
Default Config Vulnerable: ⚠️ Yes
Notes: Any application using urllib.parse.urlsplit or urlparse with user-supplied URLs is vulnerable. This includes web applications, APIs, and scripts that process URLs.

📦 What is this software?

Python by Python

Python is a high-level, interpreted programming language known for its readability and versatility. It is widely used in web development, data science, automation, and scientific computing.

Learn more about Python →

Python by Python

Python is a high-level, interpreted programming language known for its readability and versatility. It is widely used in web development, data science, automation, and scientific computing.

Learn more about Python →

Python by Python

Python is a high-level, interpreted programming language known for its readability and versatility. It is widely used in web development, data science, automation, and scientific computing.

Learn more about Python →

Python by Python

Python is a high-level, interpreted programming language known for its readability and versatility. It is widely used in web development, data science, automation, and scientific computing.

Learn more about Python →

Python by Python

Python is a high-level, interpreted programming language known for its readability and versatility. It is widely used in web development, data science, automation, and scientific computing.

Learn more about Python →

⚠️ Risk & Real-World Impact

🔴

Worst Case

Attackers steal authentication credentials, session cookies, or other sensitive data from users by tricking them into visiting malicious URLs, leading to account compromise and data breaches.

🟠

Likely Case

Credential harvesting attacks where users click on specially crafted links that appear legitimate but redirect authentication data to attacker-controlled servers.

🟢

If Mitigated

Limited impact if applications use additional validation for hostnames or implement strict same-origin policies for sensitive data.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires user interaction (clicking a malicious URL) but is straightforward once the URL is crafted. The vulnerability is well-documented and easy to weaponize.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Python 2.7.17+, 3.5.10+, 3.6.10+, 3.7.3+

Vendor Advisory: https://www.python.org/downloads/

Restart Required: Yes

Instructions:

1. Identify Python version with 'python --version'. 2. Upgrade to patched version using package manager (e.g., 'apt-get upgrade python' on Debian/Ubuntu, 'yum update python' on RHEL/CentOS). 3. Restart all Python applications and services.

🔧 Temporary Workarounds

Validate hostnames manually

all

Implement custom validation for hostnames in URL parsing to reject suspicious Unicode characters.

Use alternative URL parsing libraries

all

Replace urllib.parse with libraries like furl or yarl that are not affected.

🧯 If You Can't Patch

  • Implement strict input validation to reject URLs with non-ASCII characters in hostnames.
  • Use web application firewalls (WAFs) to block requests with suspicious Unicode patterns in URLs.

🔍 How to Verify

Check if Vulnerable:

Run 'python --version' and compare against affected versions. Test with a crafted URL containing Unicode characters in the netloc.

Check Version:

python --version

Verify Fix Applied:

After patching, test URL parsing with the same crafted URLs to ensure proper hostname resolution.

📡 Detection & Monitoring

Log Indicators:

  • Unusual Unicode characters in URL hostnames in access logs
  • Requests to unexpected domains following URL parsing

Network Indicators:

  • Outbound connections to suspicious domains after URL processing
  • Unexpected authentication attempts to external servers

SIEM Query:

search 'url_parse' OR 'urllib' AND ('unicode' OR 'NFKC') in application logs

🔗 References

📤 Share & Export