Denial of Service Vulnerability in golang

golang Updated 02 Oct 2025

Summary

04/07/2024
Yes i
High
Not published

CVE-2024-24791: Denial of service due to improper 100-continue handling in net/http. Affects golang across 2 version ranges.

< 1.21.12 >= 1.22.0-0, < 1.22.5

Fixed in 1.21.12 or 1.22.5, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2024-24791 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

The golang package is a popular open-source programming language that provides a robust development environment for building efficient and scalable applications. It is widely used for its simplicity, performance, and extensive standard library. However, the package is vulnerable to a Denial of Service (DoS) attack due to mishandling of the "Expect: 100-continue" header in the net/http HTTP/1.1 client.

Vulnerability Detail

The net/http HTTP/1.1 client in golang mishandles the case where a server responds to a request with an "Expect: 100-continue" header with a non-informational (200 or higher) status. This mishandling can lead to an invalid state in the client connection, causing the next request sent on the connection to fail. An attacker can exploit this vulnerability by sending "Expect: 100-continue" requests to a net/http/httputil.ReverseProxy proxy, eliciting non-informational responses from the backend. Each request leaves the proxy with an invalid connection, resulting in subsequent requests using that connection to fail. This can lead to a denial of service.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 1.21.12 1.21.12
  • >= 1.22.0-0, < 1.22.5 1.22.5

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

As a workaround, you can disable the use of the "Expect: 100-continue" header in the net/http client by setting the Transport.ExpectContinueTimeout field to a negative value. This can be done using the following code snippet:

package main

import (
	"net/http"
	"time"
)

func main() {
	client := &http.Client{
		Transport: &http.Transport{
			ExpectContinueTimeout: -1,
		},
	}
	// Make requests using the client
}

Conclusion

The golang package is vulnerable to a Denial of Service (DoS) attack due to mishandling of the "Expect: 100-continue" header. This can lead to invalid connections and subsequent request failures, causing service disruption. It is crucial to update the package to version 1.22.5 or higher to mitigate this vulnerability.

See every vulnerability recorded for golang →

Share this vulnerability

FAQ

Golang, also known as Go, is an open-source programming language developed by Google. It is designed to be simple, efficient, and scalable, making it popular for building a wide range of applications.

A Denial of Service (DoS) attack is a malicious attempt to disrupt the normal functioning of a network, system, or application. It aims to overwhelm the target with a flood of illegitimate requests or excessive resource consumption, rendering it unable to respond to legitimate requests.

An attacker can exploit this vulnerability by sending "Expect: 100-continue" requests to a net/http/httputil.ReverseProxy proxy, causing subsequent requests using the same connection to fail. This can lead to a denial of service, as the proxy will be left with invalid connections.

The impact of this vulnerability is a denial of service, where legitimate requests to the affected golang package may fail due to invalid connections. This can result in service disruption and potential loss of availability.

To fix this vulnerability, you should update the golang package to version 1.22.5 or higher. This will ensure that the mishandling of the "Expect: 100-continue" header is resolved, preventing the invalid connection state and potential denial of service.

Related vulnerabilities

Recent vulnerabilities recorded for golang.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 1.21.12 1.21.12
  • >= 1.22.0-0, < 1.22.5 1.22.5

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback