|
| 1 | +https://www.apache.org/security/asf-httpoxy-response.txt |
| 2 | + |
| 3 | +Apache HTTP Server may be configured to proxy HTTP requests as a forward |
| 4 | +or reverse (gateway) proxy server, can proxy requests to a FastCGI service |
| 5 | +using mod_proxy_fcgi, can directly serve CGI applications using mod_cgi |
| 6 | +or mod_cgid or the related mod_isapi service. The project's mod_fcgid |
| 7 | +subproject (available as a separate add-in module) directly manages CGI |
| 8 | +scripts using the FastCGI protocol. |
| 9 | + |
| 10 | +It may also be configured to directly host a number of external modules |
| 11 | +which run CGI-style applications in-process. The server itself does not |
| 12 | +modify the CGI environment in this case, however, these external modules |
| 13 | +may perform such modifications of their environment variables in-process. |
| 14 | +Such examples include mod_php, mod_perl and mod_wsgi. |
| 15 | + |
| 16 | +To mitigate "httpoxy" issues across all of the above mechanisms, the most |
| 17 | +direct solution is to drop any "Proxy:" header arriving from an upstream |
| 18 | +proxy server or the origin user-agent. this will mitigate the issue for any |
| 19 | +vulnerable back-end server or CGI across all traffic through this server. |
| 20 | + |
| 21 | +The two lines below enabled in the httpd.conf file will remove the "Proxy:" |
| 22 | +header from all incoming requests, before further processing; |
| 23 | + |
| 24 | + LoadModule headers_module {path-to}/mod_headers.so |
| 25 | + |
| 26 | + RequestHeader unset Proxy early |
| 27 | + |
| 28 | +(Users who have mod_headers compiled-in to the httpd binary must omit |
| 29 | +the LoadModule directive above, others must adjust the {path-to} to point |
| 30 | +to the mod_headers.so file.) |
| 31 | + |
| 32 | +If the administrator wishes to preserve the value of the "Proxy:" header |
| 33 | +for most traffic, and only eliminate it from the CGI environment variable |
| 34 | +HTTP_PROXY, a second mitigation is offered. This patch will address this |
| 35 | +behavior in mod_cgi, mod_cgid, mod_isapi, mod_proxy_fcgi and mod_fcgid, |
| 36 | +along with all other consumers of httpd's built-in environment handling. |
| 37 | + |
| 38 | +The bundled httpd modules all rely on ap_add_common_vars() to set up the |
| 39 | +target CGI environment. The project will include the recommended patch |
| 40 | +below in all subsequent releases of httpd, including 2.4.24 and 2.2.32. |
| 41 | +Users who build httpd 2.2.x or 2.4.x from source may apply the patch below, |
| 42 | +recompile and re-install httpd to obtain this mitigation. This migitation |
| 43 | +has been assigned the identifier CVE-2016-5387 <http://cve.mitre.org>. |
| 44 | + |
| 45 | +======= Patch to httpd sources 2.4.x and 2.2.x ======= |
| 46 | + |
| 47 | +--- server/util_script.c (revision 1752426) |
| 48 | ++++ server/util_script.c (working copy) |
| 49 | +@@ -186,6 +186,14 @@ AP_DECLARE(void) ap_add_common_vars(request_rec *r |
| 50 | + else if (!strcasecmp(hdrs[i].key, "Content-length")) { |
| 51 | + apr_table_addn(e, "CONTENT_LENGTH", hdrs[i].val); |
| 52 | + } |
| 53 | ++ /* HTTP_PROXY collides with a popular envvar used to configure |
| 54 | ++ * proxies, don't let clients set/override it. But, if you must... |
| 55 | ++ */ |
| 56 | ++#ifndef SECURITY_HOLE_PASS_PROXY |
| 57 | ++ else if (!strcasecmp(hdrs[i].key, "Proxy")) { |
| 58 | ++ ; |
| 59 | ++ } |
| 60 | ++#endif |
| 61 | + /* |
| 62 | + * You really don't want to disable this check, since it leaves you |
| 63 | + * wide open to CGIs stealing passwords and people viewing them |
0 commit comments