You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hpack has a panic vulnerability in the Decoder struct because it does not validate the buffer length is long enough to parse an integer in the update_max_dynamic_size function after seeing a SizeUpdate field. Here is a minimal reproduction:
All users who try to decode untrusted input using the Decoder are vulnerable to this exploit. A patched version of the crate is available on crates.io under the name hpack-patched. See Cargo's documentation on overriding dependencies for more information.
The following Git patch fixes the issue:
diff --git a/src/decoder.rs b/src/decoder.rs
index dc4f0c2..55fff45 100644
--- a/src/decoder.rs+++ b/src/decoder.rs@@ -359,7 +359,7 @@ impl<'a> Decoder<'a> {
},
FieldRepresentation::SizeUpdate => {
// Handle the dynamic table size update...
- self.update_max_dynamic_size(buffer_leftover)+ self.update_max_dynamic_size(buffer_leftover)?
}
};
@@ -445,19 +445,16 @@ impl<'a> Decoder<'a> {
/// size of the underlying dynamic table, possibly causing a number of
/// headers to be evicted from it.
///
- /// Assumes that the first byte in the given buffer `buf` is the first- /// octet in the `SizeUpdate` block.- ///
/// Returns the number of octets consumed from the given buffer.
- fn update_max_dynamic_size(&mut self, buf: &[u8]) -> usize {- let (new_size, consumed) = decode_integer(buf, 5).ok().unwrap();+ fn update_max_dynamic_size(&mut self, buf: &[u8]) -> Result<usize, DecoderError> {+ let (new_size, consumed) = decode_integer(buf, 5)?;
self.header_table.dynamic_table.set_max_table_size(new_size);
info!("Decoder changed max table size from {} to {}",
self.header_table.dynamic_table.get_size(),
new_size);
- consumed+ Ok(consumed)
}
}
The text was updated successfully, but these errors were encountered:
hpack
has a panic vulnerability in theDecoder
struct because it does not validate the buffer length is long enough to parse an integer in theupdate_max_dynamic_size
function after seeing aSizeUpdate
field. Here is a minimal reproduction:All users who try to decode untrusted input using the
Decoder
are vulnerable to this exploit. A patched version of the crate is available on crates.io under the name hpack-patched. See Cargo's documentation on overriding dependencies for more information.The following Git patch fixes the issue:
The text was updated successfully, but these errors were encountered: