Memory exhaustion during Brotli decompression (GO-2026-6888)

Memory exhaustion during Brotli decompression (GO-2026-6888)

Description

Versions of github.com/andybalholm/brotli before v1.2.7 may allocate excessive memory relative to the input size when processing repeated metablock headers during decompression. Even a small compressed input can trigger many memory allocations.

Potential impact

Services that process Brotli data from external sources may experience a sharp increase in memory use, reducing availability.

Remediation

Update github.com/andybalholm/brotli to v1.2.7 or later. Limit the resources used by decompression tasks and the number of concurrent tasks, and handle errors.

Examples

The following examples show a dependency declaration in go.mod.

Before

go
require github.com/andybalholm/brotli v1.2.6

After

go
require github.com/andybalholm/brotli v1.2.7

Update go.sum, then rebuild with the fixed module and deploy.

References