CVE-2021-31525
Description
net/http in Go before 1.15.12 and 1.16.x before 1.16.4 allows remote attackers to cause a denial of service (panic) via a large header to ReadRequest or ReadResponse. Server, Transport, and Client can each be affected in some configurations.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
net/http in Go before 1.15.12 and 1.16.x before 1.16.4 panics on oversized headers, enabling denial of service via Server, Transport, or Client.
Vulnerability
The ReadRequest and ReadResponse functions in Go's net/http package are vulnerable to an unrecoverable panic when reading a very large header. On 64-bit architectures, the threshold is over 7 MB; on 32-bit, over 4 MB. This affects Go versions before 1.15.12 and 1.16.x before 1.16.4. The Transport and Client are vulnerable by default; the Server is not vulnerable by default, but becomes so if Server.MaxHeaderBytes is set to a value higher than the default 1 MB. The issue also impacts golang.org/x/net/http2/h2c and HeaderValuesContainsToken in golang.org/x/net/http/httpguts. [1][2][3]
Exploitation
An attacker can trigger the panic without authentication by sending an HTTP request or response containing a header that exceeds the threshold sizes mentioned above. For a Transport or Client, a malicious server sends an oversized response header. For a Server configured with an elevated MaxHeaderBytes, a malicious client sends an oversized request header. No special network position is required beyond being able to send or receive HTTP messages over the network. [2][3]
Impact
Successful exploitation causes the Go process to panic and crash, resulting in a denial of service. The impact is limited to availability (service interruption). There is no disclosure of information or privilege escalation described in the references. [1][3]
Mitigation
Upgrade to Go 1.16.4 or 1.15.12, released on 2021-05-27, which includes the fix. For uses of golang.org/x/net, upgrade to version v0.0.0-20210428140749-89ef3d95e781. Workarounds include keeping Server.MaxHeaderBytes at the default value (1 MB) to avoid exposing the server to the vulnerability. No EOL or KEV listing is noted. [2][3]
AI Insight generated on May 21, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
golang.org/x/netGo | < 0.0.0-20210428140749-89ef3d95e781 | 0.0.0-20210428140749-89ef3d95e781 |
Affected products
20- Go/Godescription
- osv-coords19 versionspkg:apk/chainguard/grpcurlpkg:apk/chainguard/heypkg:apk/chainguard/k3dpkg:apk/chainguard/k3d-proxypkg:apk/chainguard/k3d-toolspkg:apk/chainguard/terraform-provider-sendgridpkg:apk/chainguard/terraform-provider-sendgrid-fipspkg:apk/wolfi/grpcurlpkg:apk/wolfi/heypkg:apk/wolfi/k3dpkg:apk/wolfi/k3d-proxypkg:apk/wolfi/k3d-toolspkg:apk/wolfi/terraform-provider-sendgridpkg:bitnami/golangpkg:golang/golang.org/x/netpkg:rpm/suse/go1.15&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Development%20Tools%2015%20SP2pkg:rpm/suse/go1.15&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Development%20Tools%2015%20SP3pkg:rpm/suse/go1.16&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Development%20Tools%2015%20SP2pkg:rpm/suse/go1.16&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Development%20Tools%2015%20SP3
< 1.8.7-r7+ 18 more
- (no CPE)range: < 1.8.7-r7
- (no CPE)range: < 0.1.4-r3
- (no CPE)range: < 5.6.0-r11
- (no CPE)range: < 5.6.0-r11
- (no CPE)range: < 5.6.0-r11
- (no CPE)range: < 1.0.1-r1
- (no CPE)range: < 1.0.1-r1
- (no CPE)range: < 1.8.7-r7
- (no CPE)range: < 0.1.4-r3
- (no CPE)range: < 5.6.0-r11
- (no CPE)range: < 5.6.0-r11
- (no CPE)range: < 5.6.0-r11
- (no CPE)range: < 1.0.1-r1
- (no CPE)range: < 1.15.12
- (no CPE)range: < 0.0.0-20210428140749-89ef3d95e781
- (no CPE)range: < 1.15.12-1.30.1
- (no CPE)range: < 1.15.12-1.30.1
- (no CPE)range: < 1.16.4-1.14.2
- (no CPE)range: < 1.16.4-1.14.2
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
11- github.com/advisories/GHSA-h86h-8ppg-mxmhghsaADVISORY
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/ISRZZ6NY5R2TBYE72KZFOCO25TEUQTBF/mitrevendor-advisoryx_refsource_FEDORA
- nvd.nist.gov/vuln/detail/CVE-2021-31525ghsaADVISORY
- security.gentoo.org/glsa/202208-02ghsavendor-advisoryx_refsource_GENTOOWEB
- github.com/golang/go/issues/45710ghsax_refsource_MISCWEB
- go.dev/cl/313069ghsaWEB
- go.dev/issue/45710ghsaWEB
- go.googlesource.com/net/+/89ef3d95e781148a0951956029c92a211477f7f9ghsaWEB
- groups.google.com/g/golang-announce/c/cu9SP4eSXMcghsax_refsource_MISCWEB
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/ISRZZ6NY5R2TBYE72KZFOCO25TEUQTBFghsaWEB
- pkg.go.dev/vuln/GO-2022-0236ghsaWEB
News mentions
0No linked articles in our index yet.