Closed
Description
Version
0.14.12
Description
Hyper does not open the customization of the max_header_list_size method in the H2 third-party software.
The H2 interface is as follows:
/// Sets the max size of received header frames.
///
/// This advisory setting informs a peer of the maximum size of header list
/// that the sender is prepared to accept, in octets. The value is based on
/// the uncompressed size of header fields, including the length of the name
/// and value in octets plus an overhead of 32 octets for each header field.
///
/// This setting is also used to limit the maximum amount of data that is
/// buffered to decode HEADERS frames.
///
/// # Examples
///
/// ```
/// # use tokio::io::{AsyncRead, AsyncWrite};
/// # use h2::server::*;
/// #
/// # fn doc<T: AsyncRead + AsyncWrite + Unpin>(my_io: T)
/// # -> Handshake<T>
/// # {
/// // `server_fut` is a future representing the completion of the HTTP/2.0
/// // handshake.
/// let server_fut = Builder::new()
/// .max_header_list_size(16 * 1024)
/// .handshake(my_io);
/// # server_fut
/// # }
/// #
/// # pub fn main() {}
/// ```
pub fn max_header_list_size(&mut self, max: u32) -> &mut Self {
self.settings.set_max_header_list_size(Some(max));
self
}
The default value of max_header_list_size in h2 is 16m.
As a result, HTTP2 attacks may occur when Hyper is used.
Attack scenario: Hyper is used as the server and continues to send continuance frames without ending. The data of each continuance frame is 10 KB. Each thread sends 1023 continuance frames, that is, about 10 MB. Multiple threads are started to send continuance frames. As a result, the memory of the service is exploded.
Activity