Python urllib Header Injection Vulnerability via Control Characters in Data URLs

Vulnerability

A vulnerability exists in the Python standard library's urllib module, specifically within the DataHandler component. This issue allows for header injection by exploiting user-controlled data URLs. The vulnerability arises from the improper handling of control characters in the data URL mediatype, which can be used to inject newlines and manipulate header parsing.

Impact

Exploitation of this vulnerability could lead to arbitrary header injection, potentially allowing for manipulation of HTTP headers in a way that could be exploited by an attacker.

Reproduction

To reproduce this vulnerability, create a data URL that includes control characters, such as C0 control characters, in the mediatype portion of the URL. This can be done by crafting a data URL that deliberately includes newlines or other control characters in the mediatype, which will then be parsed by urllib's DataHandler. The injected control characters can manipulate how headers are processed, leading to the injection of arbitrary headers.

Remediation

Users should update to the latest version of Python where this vulnerability has been addressed. Instructions for updating Python can be found on the official Python website.

Added: Jan 20, 2026, 11:43 PM
Updated: Jan 20, 2026, 11:43 PM

Vulnerability Rating

Custom Algorithm
spread
9.0
impact
0.6
exploitability
5.7
remediation
7.7
relevance
2.2
threat
4.8
urgency
2.9
incentive
0.0

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.