mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
[merge from 3.4] - 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.
This commit is contained in:
commit
17742f2d45
5 changed files with 42 additions and 0 deletions
|
@ -2412,6 +2412,12 @@ 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 "proxy" is lowercase, it will still be used thanks to the next block
|
||||
if 'REQUEST_METHOD' in os.environ:
|
||||
proxies.pop('http', None)
|
||||
for name, value in os.environ.items():
|
||||
if name[-6:] == '_proxy':
|
||||
name = name.lower()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue