Uncontrolled Recursion Affecting std/net/http package, versions <1.15.12>=1.16.0-0 <1.16.4


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.02% (6th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Uncontrolled Recursion vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-GOLANG-STDNETHTTP-14548600
  • published6 Jan 2026
  • disclosed15 Jul 2022
  • creditGuido Vranken

Introduced: 15 Jul 2022

CVE-2021-31525  (opens in a new tab)
CWE-674  (opens in a new tab)

How to fix?

Upgrade std/net/http to version 1.15.12, 1.16.4 or higher.

Overview

std/net/http is a Go standard library package std/net/http

Affected versions of this package are vulnerable to Uncontrolled Recursion.

Go Vulnerability Report:
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.

CVSS Base Scores

version 4.0
version 3.1