Advisory

GO-2022-0236

Also known as: BIT-golang-2021-31525, CVE-2021-31525, GHSA-h86h-8ppg-mxmh

Summary

Panic due to large headers in net/http and golang.org/x/net/http/httpguts

Details

A malicious HTTP server or client can cause the net/http client or server to panic.

ReadRequest and ReadResponse can hit an unrecoverable panic when reading a very large header (over 7MB on 64-bit architectures, or over 4MB on 32-bit ones). Transport and Client are vulnerable and the program can be made to crash by a malicious server. Server is not vulnerable by default, but can be if the default max header of 1MB is overridden by setting Server.MaxHeaderBytes to a higher value, in which case the program can be made to crash by a malicious client.

This also affects golang.org/x/net/http2/h2c and HeaderValuesContainsToken in golang.org/x/net/http/httpguts.

Severity

Not rated by the source.

Dates

Published
2022-07-15 23:04 UTC
Modified
2026-02-04 02:54 UTC

Affected packages and fixes

stdlib

Go · All systems

Affected

  • introduced 0, fixed 1.15.12, introduced 1.16.0-0, fixed 1.16.4 (semver)

Fixed versions

1.15.12, 1.16.4

Fix

The export has no generic command for this ecosystem.

golang.org/x/net

Go · All systems

Affected

  • introduced 0, fixed 0.0.0-20210428140749-89ef3d95e781 (semver)

Fixed versions

0.0.0-20210428140749-89ef3d95e781

Fix

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: Go Vulnerability Database · CC BY 4.0

Sources & licences