CRLF Injection in urllib3

py3-urllib3 Updated 02 Oct 2025

Summary

30/09/2020
N/A
Yes i
Medium
6.5

CVE-2020-26137: urllib3 before 1.25.9 allows CRLF injection if the attacker controls the HTTP request method, as demonstrated by inserting CR and LF control characters in the first argument of putrequest(). Affects py3-urllib3 across 2 version ranges.

< 1.25.9-r0 < 1dd69c5c5982fae7c87a620d487c2ebf7a6b436b

Fixed in 1.25.9-r0. 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 Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

urllib3 is a powerful HTTP client library for Python, providing a simple and intuitive interface for making HTTP requests. It is widely used in various applications and frameworks. However, urllib3 versions before 1.25.9 are vulnerable to CRLF injection if the attacker controls the HTTP request method. This vulnerability allows the attacker to insert carriage return (CR) and line feed (LF) control characters in the first argument of the putrequest() function. This can lead to various attacks, including HTTP response splitting, cache poisoning, and cross-site scripting (XSS).

Vulnerability Detail

The vulnerability (CVE-2020-26137) originates from a lack of proper input validation in urllib3. By manipulating the HTTP request method, an attacker can inject CR and LF characters into the request, potentially altering the intended behavior of the server or injecting malicious content. This can result in serious security implications, such as the ability to manipulate headers, perform XSS attacks, or poison caches. The vulnerability has a CVSS score of 6.5, indicating a medium severity level.

How To Fix

Minimum fixed version

1.25.9-r0

This is the first release that contains the fix.

sudo apk add --upgrade py3-urllib3

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

Workaround

As a temporary workaround, developers can manually sanitize the input to remove any CR and LF characters before passing it to the putrequest() function. This can be achieved by using appropriate input validation and sanitization techniques, such as regular expressions or string manipulation functions. However, applying the official fix by upgrading urllib3 is the recommended approach.

Conclusion

The CRLF injection vulnerability in urllib3 (CVE-2020-26137) can have serious security implications, allowing attackers to manipulate HTTP requests and potentially compromise the integrity and security of the affected system. It is crucial for developers to upgrade urllib3 to version 1.25.9 or later to mitigate this vulnerability. Regularly monitoring for security updates and applying them promptly is essential to maintain the security of applications.

See every vulnerability recorded for py3-urllib3 →

Share this vulnerability

FAQ

urllib3 is a Python library used for making HTTP requests. It provides a high-level interface for interacting with web servers and handling various aspects of the HTTP protocol.

CRLF injection is a web application vulnerability that allows an attacker to insert carriage return (CR) and line feed (LF) characters into HTTP requests or responses. This can lead to various attacks, such as HTTP response splitting, cache poisoning, and cross-site scripting (XSS).

The consequences of this vulnerability can vary depending on the specific context and application. However, possible ramifications include header manipulation, XSS attacks, cache poisoning, and potentially compromising the integrity and security of the affected system.

You can use Vulert's playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability. Vulert monitors and alerts in real-time for open-source vulnerabilities, using just a manifest file like package-lock.json.

While specific exploits for this vulnerability have not been disclosed, the potential impact of CRLF injection vulnerabilities is well-documented. It is crucial to promptly apply the recommended fixes and stay vigilant for any signs of exploitation.

Related vulnerabilities

Recent vulnerabilities recorded for py3-urllib3.

How To Fix

Minimum fixed version

1.25.9-r0

This is the first release that contains the fix.

sudo apk add --upgrade py3-urllib3

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