Skip to content

Commit b4eb5d6

Browse files
committed
www/apache24: Fix httpoxy vulnerability (+2.2)
- Add upstream patch to www/apache24 - Add upstream patch to www/apache22 - Bump PORTREVISION Approved by: feld (ports-secteam) MFH: 2016Q3 Security: cf0b5668-4d1b-11e6-b2ec-b499baebfeaf Security: CVE-2016-5387
1 parent a736a20 commit b4eb5d6

4 files changed

Lines changed: 128 additions & 1 deletion

File tree

‎www/apache22/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
PORTNAME= apache22
44
PORTVERSION= 2.2.31
5-
PORTREVISION?= 0
5+
PORTREVISION?= 1
66
CATEGORIES= www ipv6
77
MASTER_SITES= APACHE_HTTPD
88
DISTNAME= httpd-${PORTVERSION}

‎www/apache22/files/patch-httpoxy‎

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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

‎www/apache24/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
PORTNAME= apache24
44
PORTVERSION= 2.4.23
5+
PORTREVISION= 1
56
CATEGORIES= www ipv6
67
MASTER_SITES= APACHE_HTTPD
78
DISTNAME= httpd-${PORTVERSION}

‎www/apache24/files/patch-httpoxy‎

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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

Comments
 (0)