CVE-2022-41717: golang.org/x/net/http2 vulnerable to possible excessive memory growth
5.3
Basic Information
Technical Details
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| golang.org/x/net/http2 | go | < 0.4.0 | 0.4.0 |
| golang.org/x/net | go | < 0.4.0 | 0.4.0 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability CVE-2022-41717 concerns excessive memory growth in a Go HTTP/2 server due to large header keys. The fix involves limiting the header cache by bytes, not just by the number of entries. I analyzed the likely code paths for HTTP/2 header processing and HPACK decoding based on the vulnerability description and the commit message 'x/net/http2: incoming header list size limit' associated with the fix (though direct diff fetching failed).
The primary changes involve:
- Introducing a
maxHeaderListSizeat thehttp2.Serverlevel, which is then used byserverConn. - Modifying
(*serverConn).readMetaFrameto use this limit to configure thehpack.DecoderviaSetMaxStringLength(to limit individual header field sizes) and to check the total decoded size viaBytesLength. - Enhancing
hpack.Decoder(specificallyemitmethod) andhpack.dynamicTable(specificallyaddmethod) to track and limit the total byte size of header strings stored in the dynamic table, not just the number of entries or per-entry sizes.
The identified functions are central to these patched mechanisms:
(*serverConn).readMetaFrameis the entry point inhttp2/server.gothat orchestrates header decoding and now applies the overall byte limit for a header list.(*hpack.Decoder).emitand(*hpack.dynamicTable).addare in thehttp2/hpack/package and are responsible for the low-level mechanics of adding headers to the dynamic table. Before the patch, their mechanisms for limiting memory were insufficient against attacks using many large keys, leading to the vulnerability. The patch added more robust byte-size tracking and limiting within these functions.
The confidence is high because these functions directly correspond to the areas (HTTP/2 server header processing and HPACK dynamic table management) where byte-based limits would be introduced to mitigate the described vulnerability. The failure to fetch commit diffs via tools means patch evidence is descriptive based on the commit message and file paths involved in the CL, rather than direct code snippets from the patch.