Improper Handling of Unicode Encoding in Python

python2 Updated 02 Oct 2025

Summary

08/03/2019
N/A
Yes i
Critical
9.8

CVE-2019-9636: Python 2.7.x through 2.7.16 and 3.x through 3.7.2 is affected by: Improper Handling of Unicode Encoding (with an incorrect netloc) during NFKC normalization. Affects python2 across 2 version ranges.

< 2.7.16-r1 < c2f86d86e6c8f5fd1ef602128b537a48f3f5c063

Fixed in 2.7.16-r1. 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 popular programming language known for its simplicity and versatility. It is widely used for web development, data analysis, and automation tasks. The vulnerability, CVE-2019-9636, affects Python versions 2.7.x through 2.7.16 and 3.x through 3.7.2. It specifically targets the urllib.parse.urlsplit and urllib.parse.urlparse components, which are responsible for parsing URLs. The vulnerability arises from an improper handling of Unicode encoding, specifically when dealing with an incorrect netloc during NFKC normalization.

Vulnerability Detail

The vulnerability allows for information disclosure, potentially exposing sensitive data such as credentials and cookies. When a specially crafted URL is incorrectly parsed, it can lead to the retrieval of cached data against a given hostname and send that information to a different host. This can result in unauthorized access and potential misuse of sensitive data. The impact of this vulnerability is significant, as it can compromise the security and integrity of affected systems.

How To Fix

Minimum fixed version

2.7.16-r1

This is the first release that contains the fix.

sudo apk add --upgrade python2

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

Workaround

As a workaround, it is advised to sanitize and validate user input before passing it to the affected components. This can help prevent the exploitation of the vulnerability. Here is an example of how to sanitize a URL using the urllib.parse module in Python:

import urllib.parse

url = 'https://example.com/';

Sanitize and validate the URL

sanitized_url = urllib.parse.quote(url, safe=':/')

Use the sanitized URL in further processing

print(sanitized_url)

Conclusion

The vulnerability CVE-2019-9636 in Python's urllib.parse.urlsplit and urllib.parse.urlparse components can lead to information disclosure and potential unauthorized access to sensitive data. It is crucial to update to the fixed Python versions mentioned in the 'how_to_fix' section to mitigate this vulnerability. Additionally, sanitizing and validating user input can serve as a temporary workaround. For further assistance and support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for python2 →

Share this vulnerability

FAQ

The vulnerability can lead to information disclosure, potentially exposing sensitive data such as credentials and cookies. It can be exploited to retrieve cached data against a given hostname and send it to a different host.

Python versions 2.7.x through 2.7.16 and 3.x through 3.7.2 are affected.

Update your Python installation to one of the fixed versions mentioned in the 'how_to_fix' section.

Yes, you can sanitize and validate user input before passing it to the affected components to mitigate the vulnerability. Refer to the 'workaround' section for an example.

You can find more information about this vulnerability, including its technical details and the fixed versions, in the provided CVE-2019-9636.json file.

Related vulnerabilities

Recent vulnerabilities recorded for python2.

How To Fix

Minimum fixed version

2.7.16-r1

This is the first release that contains the fix.

sudo apk add --upgrade python2

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