This might not be something you can fix, but I wanted to report it since people might have vulnerable configs.
Gunicorn reads some WSGI variables from request headers. This can be an issue when a proxy allows and passes along these special header values.
For example SCRIPT_NAME is used to transform PATH_INFO. If a proxy previously parsed the request path to determine if access is allowed, and attacker could now use a SCRIPT_NAME header to bypass the proxy.
Here is an example nginx config:
server {
listen 80;
underscores_in_headers on;
location / {
include proxy_params;
proxy_pass http://unix:/tmp/gunicorn.sock;
proxy_pass_request_headers on;
location ^~ /admin/ {
deny all; # disallow anyone from accessing any routes starting with /admin/
}
}
This request will call the /admin/something/bad route in the WSGI app despite nginx's deny all.
requests.get(URL+'/REMOVED/admin/something/bad', headers={'script_name':'REMOVED/'})