diff options
author | Senthil Kumaran <senthil@uthcode.com> | 2016-07-30 23:34:34 -0700 |
---|---|---|
committer | Senthil Kumaran <senthil@uthcode.com> | 2016-07-30 23:34:34 -0700 |
commit | 436fe5a447abb69e5e5a4f453325c422af02dcaa (patch) | |
tree | 6087c6640f2e39e4e8bd1e7b7b6490e8e0b7f324 /Lib/urllib | |
parent | b7b5d35545d2d078e868cbda485bc4651edec4ff (diff) | |
parent | 4cbb23f8f278fd1f71dcd5968aa0b3f0b4f3bd5d (diff) | |
download | cpython-git-436fe5a447abb69e5e5a4f453325c422af02dcaa.tar.gz |
[merge from 3.3] Prevent HTTPoxy attack (CVE-2016-1000110)
Ignore the HTTP_PROXY variable when REQUEST_METHOD environment is set, which
indicates that the script is in CGI mode.
Issue #27568 Reported and patch contributed by RĂ©mi Rampin.
Diffstat (limited to 'Lib/urllib')
-rw-r--r-- | Lib/urllib/request.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index 376bba4079..f769386e0e 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -2337,6 +2337,13 @@ def getproxies_environment(): name = name.lower() if value and name[-6:] == '_proxy': proxies[name[:-6]] = value + + # CVE-2016-1000110 - If we are running as CGI script, forget HTTP_PROXY + # (non-all-lowercase) as it may be set from the web server by a "Proxy:" + # header from the client + if 'REQUEST_METHOD' in os.environ: + proxies.pop('http', None) + return proxies def proxy_bypass_environment(host): |