mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[merge from 3.5] - 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
cde03fa038
6 changed files with 43 additions and 0 deletions
|
@ -2477,6 +2477,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