|
|
340a5c |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
340a5c |
From: Lumir Balhar <lbalhar@redhat.com>
|
|
|
340a5c |
Date: Tue, 14 Sep 2021 11:34:43 +0200
|
|
|
340a5c |
Subject: [PATCH] 00366-CVE-2021-3733.patch
|
|
|
340a5c |
|
|
|
340a5c |
00366 #
|
|
|
340a5c |
CVE-2021-3733: Fix ReDoS in urllib AbstractBasicAuthHandler
|
|
|
340a5c |
|
|
|
340a5c |
Fix Regular Expression Denial of Service (ReDoS) vulnerability in
|
|
|
340a5c |
urllib2.AbstractBasicAuthHandler. The ReDoS-vulnerable regex
|
|
|
340a5c |
has quadratic worst-case complexity and it allows cause a denial of
|
|
|
340a5c |
service when identifying crafted invalid RFCs. This ReDoS issue is on
|
|
|
340a5c |
the client side and needs remote attackers to control the HTTP server.
|
|
|
340a5c |
|
|
|
340a5c |
Backported from Python 3 together with another backward-compatible
|
|
|
340a5c |
improvement of the regex from fix for CVE-2020-8492.
|
|
|
340a5c |
|
|
|
340a5c |
Co-authored-by: Yeting Li <liyt@ios.ac.cn>
|
|
|
340a5c |
---
|
|
|
340a5c |
Lib/urllib2.py | 2 +-
|
|
|
340a5c |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
340a5c |
|
|
|
340a5c |
diff --git a/Lib/urllib2.py b/Lib/urllib2.py
|
|
|
340a5c |
index fd19e1ae943..e286583ecba 100644
|
|
|
340a5c |
--- a/Lib/urllib2.py
|
|
|
340a5c |
+++ b/Lib/urllib2.py
|
|
|
340a5c |
@@ -858,7 +858,7 @@ class AbstractBasicAuthHandler:
|
|
|
340a5c |
|
|
|
340a5c |
# allow for double- and single-quoted realm values
|
|
|
340a5c |
# (single quotes are a violation of the RFC, but appear in the wild)
|
|
|
340a5c |
- rx = re.compile('(?:.*,)*[ \t]*([^ \t]+)[ \t]+'
|
|
|
340a5c |
+ rx = re.compile('(?:[^,]*,)*[ \t]*([^ \t,]+)[ \t]+'
|
|
|
340a5c |
'realm=(["\']?)([^"\']*)\\2', re.I)
|
|
|
340a5c |
|
|
|
340a5c |
# XXX could pre-emptively send auth info already accepted (RFC 2617,
|