title: Denial of service via chunk extensions in net/http
description: A malicious HTTP sender can use chunk extensions to cause a receiver reading from a request or response body to read many more bytes from the network than are in the body. A malicious HTTP client can further exploit this to cause a server to automatically read a large amount of data (up to about 1GiB) when a handler fails to read the entire body of a request. Chunk extensions are a little-used HTTP feature which permit including additional metadata in a request or response body sent using the chunked encoding. The net/http chunked encoding reader discards this metadata. A sender can exploit this by inserting a large metadata segment with each byte transferred. The chunk reader now produces an error if the ratio of real body to encoded bytes grows too small.
problem types: CWE-400: Uncontrolled Resource Consumption
affected:
{
vendor: Go standard library
product: net/http/internal
collectionURL: https://pkg.go.dev
packageName: net/http/internal
versions:
version: 0, lessThan: 1.20.12, status: affected, versionType: semver
version: 1.21.0-0, lessThan: 1.21.5, status: affected, versionType: semver
programRoutines:
name: chunkedReader.beginChunk
name: readChunkLine
name: chunkedReader.Read
defaultStatus: unaffected
}