Blame SOURCES/00366-CVE-2021-3733.patch

dd3e76
From 29c669440dddba61d18e1b7fdd57180cae9e4ae3 Mon Sep 17 00:00:00 2001
dd3e76
From: Yeting Li <liyt@ios.ac.cn>
dd3e76
Date: Wed, 7 Apr 2021 19:27:41 +0800
dd3e76
Subject: [PATCH] bpo-43075: Fix ReDoS in urllib AbstractBasicAuthHandler
dd3e76
 (GH-24391)
dd3e76
dd3e76
Fix Regular Expression Denial of Service (ReDoS) vulnerability in
dd3e76
urllib.request.AbstractBasicAuthHandler. The ReDoS-vulnerable regex
dd3e76
has quadratic worst-case complexity and it allows cause a denial of
dd3e76
service when identifying crafted invalid RFCs. This ReDoS issue is on
dd3e76
the client side and needs remote attackers to control the HTTP server.
dd3e76
(cherry picked from commit 7215d1ae25525c92b026166f9d5cac85fb1defe1)
dd3e76
dd3e76
Co-authored-by: Yeting Li <liyt@ios.ac.cn>
dd3e76
---
dd3e76
 Lib/urllib/request.py                                           | 2 +-
dd3e76
 .../next/Security/2021-01-31-05-28-14.bpo-43075.DoAXqO.rst      | 1 +
dd3e76
 2 files changed, 2 insertions(+), 1 deletion(-)
dd3e76
 create mode 100644 Misc/NEWS.d/next/Security/2021-01-31-05-28-14.bpo-43075.DoAXqO.rst
dd3e76
dd3e76
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
dd3e76
index 6624e04317ba2..56565405a7097 100644
dd3e76
--- a/Lib/urllib/request.py
dd3e76
+++ b/Lib/urllib/request.py
dd3e76
@@ -947,7 +947,7 @@ class AbstractBasicAuthHandler:
dd3e76
     # (single quotes are a violation of the RFC, but appear in the wild)
dd3e76
     rx = re.compile('(?:^|,)'   # start of the string or ','
dd3e76
                     '[ \t]*'    # optional whitespaces
dd3e76
-                    '([^ \t]+)' # scheme like "Basic"
dd3e76
+                    '([^ \t,]+)' # scheme like "Basic"
dd3e76
                     '[ \t]+'    # mandatory whitespaces
dd3e76
                     # realm=xxx
dd3e76
                     # realm='xxx'
dd3e76
diff --git a/Misc/NEWS.d/next/Security/2021-01-31-05-28-14.bpo-43075.DoAXqO.rst b/Misc/NEWS.d/next/Security/2021-01-31-05-28-14.bpo-43075.DoAXqO.rst
dd3e76
new file mode 100644
dd3e76
index 0000000000000..1c9f727e965fb
dd3e76
--- /dev/null
dd3e76
+++ b/Misc/NEWS.d/next/Security/2021-01-31-05-28-14.bpo-43075.DoAXqO.rst
dd3e76
@@ -0,0 +1 @@
dd3e76
+Fix Regular Expression Denial of Service (ReDoS) vulnerability in :class:`urllib.request.AbstractBasicAuthHandler`.  The ReDoS-vulnerable regex has quadratic worst-case complexity and it allows cause a denial of service when identifying crafted invalid RFCs. This ReDoS issue is on the client side and needs remote attackers to control the HTTP server.