diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-04-07 15:58:04 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-07 15:58:04 (GMT) |
commit | a21d4fbd549ec9685068a113660553d7f80d9b09 (patch) | |
tree | aa1d4f51ef63d73f1dfdb9a2a58b92185094b55d /Lib/urllib | |
parent | 0af99b44edf559305def22b2d68be685ce50d7f6 (diff) | |
download | cpython-a21d4fbd549ec9685068a113660553d7f80d9b09.zip cpython-a21d4fbd549ec9685068a113660553d7f80d9b09.tar.gz cpython-a21d4fbd549ec9685068a113660553d7f80d9b09.tar.bz2 |
bpo-43075: Fix ReDoS in urllib AbstractBasicAuthHandler (GH-24391) (GH-25247)
Fix Regular Expression Denial of Service (ReDoS) vulnerability in
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.
(cherry picked from commit 7215d1ae25525c92b026166f9d5cac85fb1defe1)
Co-authored-by: Yeting Li <liyt@ios.ac.cn>
Co-authored-by: Yeting Li <liyt@ios.ac.cn>
Diffstat (limited to 'Lib/urllib')
-rw-r--r-- | Lib/urllib/request.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index 57d9914..af3fb9c 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -943,7 +943,7 @@ class AbstractBasicAuthHandler: # (single quotes are a violation of the RFC, but appear in the wild) rx = re.compile('(?:^|,)' # start of the string or ',' '[ \t]*' # optional whitespaces - '([^ \t]+)' # scheme like "Basic" + '([^ \t,]+)' # scheme like "Basic" '[ \t]+' # mandatory whitespaces # realm=xxx # realm='xxx' |