Line 0
Link Here
|
|
|
1 |
Security Advisory - Apache Software Foundation |
2 |
Apache HTTPD WebServer / httpd.apache.org |
3 |
|
4 |
Server memory can be exhausted and service denied when HTTP/2 is used |
5 |
|
6 |
CVE-2016-8740 |
7 |
|
8 |
The Apache HTTPD web server (from 2.4.17-2.4.23) did not apply limitations |
9 |
on request headers correctly when experimental module for the HTTP/2 |
10 |
protocol is used to access a resource. |
11 |
|
12 |
The net result is that a the server allocates too much memory instead of denying |
13 |
the request. This can lead to memory exhaustion of the server by a properly |
14 |
crafted request. |
15 |
|
16 |
Background: |
17 |
- ----------- |
18 |
|
19 |
Apache has limits on the number and length of request header fields. which |
20 |
limits the amount of memory a client can allocate on the server for a request. |
21 |
|
22 |
Version 2.4.17 of the Apache HTTP Server introduced an experimental feature: |
23 |
mod_http2 for the HTTP/2 protocol (RFC7540, previous versions were known as |
24 |
Google SPDY). |
25 |
|
26 |
This module is NOT compiled in by default -and- is not enabled by default, |
27 |
although some distribution may have chosen to do so. |
28 |
|
29 |
It is generally needs to be enabled in the 'Protocols' line in httpd by |
30 |
adding 'h2' and/or 'h2c' to the 'http/1.1' only default. |
31 |
|
32 |
The default distributions of the Apache Software Foundation do not include |
33 |
this experimental feature. |
34 |
|
35 |
Details: |
36 |
- -------- |
37 |
|
38 |
- From version 2.4.17, upto and including version 2.4.23 the server failed |
39 |
to take the limitations on request memory use into account when providing |
40 |
access to a resource over HTTP/2. This issue has been fixed |
41 |
in version 2.4.23 (r1772576). |
42 |
|
43 |
As a result - with a request using the HTTP/2 protocol a specially crafted |
44 |
request can allocate memory on the server until it reaches its limit. This can |
45 |
lead to denial of service for all requests against the server. |
46 |
|
47 |
Impact: |
48 |
- ------- |
49 |
|
50 |
This can lead to denial of service for all server resources. |
51 |
Versions affected: |
52 |
- ------------------ |
53 |
All versions from 2.4.17 to 2.4.23. |
54 |
|
55 |
Resolution: |
56 |
- ----------- |
57 |
|
58 |
For a 2.4.23 version a patch is supplied. This will be included in the |
59 |
next release. |
60 |
|
61 |
Mitigations and work arounds: |
62 |
- ----------------------------- |
63 |
|
64 |
As a temporary workaround - HTTP/2 can be disabled by changing |
65 |
the configuration by removing h2 and h2c from the Protocols |
66 |
line(s) in the configuration file. |
67 |
|
68 |
The resulting line should read: |
69 |
|
70 |
Protocols http/1.1 |
71 |
|
72 |
Credits and timeline |
73 |
- -------------------- |
74 |
|
75 |
The flaw was found and reported by Naveen Tiwari <naveen.tiwari@asu.edu> |
76 |
and CDF/SEFCOM at Arizona State University on 2016-11-22. The issue was |
77 |
resolved by Stefan Eissing and incorporated in the Apache repository, |
78 |
ready for inclusion in the next release. |
79 |
|
80 |
Apache would like to thank all involved for their help with this. |
81 |
|
82 |
Index: modules/http2/h2_stream.c |
83 |
=================================================================== |
84 |
--- modules/http2/h2_stream.c (revision 1771866) |
85 |
+++ modules/http2/h2_stream.c (working copy) |
86 |
@@ -322,18 +322,18 @@ |
87 |
HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE); |
88 |
} |
89 |
} |
90 |
- } |
91 |
- |
92 |
- if (h2_stream_is_scheduled(stream)) { |
93 |
- return h2_request_add_trailer(stream->request, stream->pool, |
94 |
- name, nlen, value, vlen); |
95 |
- } |
96 |
- else { |
97 |
- if (!input_open(stream)) { |
98 |
- return APR_ECONNRESET; |
99 |
+ |
100 |
+ if (h2_stream_is_scheduled(stream)) { |
101 |
+ return h2_request_add_trailer(stream->request, stream->pool, |
102 |
+ name, nlen, value, vlen); |
103 |
} |
104 |
- return h2_request_add_header(stream->request, stream->pool, |
105 |
- name, nlen, value, vlen); |
106 |
+ else { |
107 |
+ if (!input_open(stream)) { |
108 |
+ return APR_ECONNRESET; |
109 |
+ } |
110 |
+ return h2_request_add_header(stream->request, stream->pool, |
111 |
+ name, nlen, value, vlen); |
112 |
+ } |
113 |
} |
114 |
} |
115 |
|
116 |
|