When "Trailer" headers are sent by a client, the HTTP server internally uses the header values to populate the Request.Trailer map passed to the server handler. Because Request.Trailer is a map, each entry incurs memory overhead. For HTTP/2 servers, a malicious client can exploit this by sending a "Trailer" header that declares a large number of fields, causing the server to allocate a disproportionate amount of memory while bypassing Server.MaxHeaderValueCount and Server.MaxHeaderBytes limits. This exploit is not applicable for HTTP/1 servers, which do not support multiplexing a large number of requests over one TCP connection, and whose Server.MaxHeaderBytes are calculated differently.
Summary
AIGo's HTTP/2 servers can allocate disproportionate memory when a client declares a large number of fields in a Trailer header. A malicious network client can bypass Server.MaxHeaderValueCount and Server.MaxHeaderBytes limits this way; the described exploit does not apply to HTTP/1 servers.
Who should check
Engineers running HTTP/2 servers using Go standard library net/http or net/http/internal/http2, or golang.org/x/net/http2, should check their deployments; affected versions were not provided.
What to do
- 1Consult the Go vendor advisory for affected versions and fixes.
- 2Apply the vendor-recommended fix.