fix(runtime): cap CONTINUATION frame count per header block (MOLO-H2-003)
kH2HeaderListMax only bounded accumulated header bytes across HEADERS plus CONTINUATION frames, so an attacker could flood zero-length CONTINUATION frames on an open header block (CVE-2024-27316 class) forever without tripping the byte cap, each still costing a 9-byte frame parse. Add an independent kH2MaxContinuationFramesPerHeaderBlock cap in caps.h and enforce it in H2Connection::OnContinuation, closing the connection via the same Fatal(kCompressionError) GOAWAY path already used for the byte cap. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -57,6 +57,10 @@ inline constexpr std::size_t kH2HeaderTableDefault = 4096;
|
||||
inline constexpr std::size_t kH2HeaderTableCeiling = 16384;
|
||||
inline constexpr std::size_t kH2HeaderListMax = 65536;
|
||||
inline constexpr std::size_t kH2MaxFrameHeaderListCap = 100;
|
||||
// Independent of kH2HeaderListMax (bytes): caps CONTINUATION frame *count*
|
||||
// for one open header block, so a flood of zero-length CONTINUATION frames
|
||||
// (near-zero byte growth) cannot evade the byte cap. CVE-2024-27316 class.
|
||||
inline constexpr std::size_t kH2MaxContinuationFramesPerHeaderBlock = 64;
|
||||
|
||||
// 6.5 Compression.
|
||||
inline constexpr std::size_t kCompressThreshold = 1024;
|
||||
|
||||
Reference in New Issue
Block a user