Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2022-27664

CVE-2022-27664: Golang Go HTTP/2 DoS Vulnerability

CVE-2022-27664 is a denial of service vulnerability in Golang Go's net/http package affecting HTTP/2 connections. Attackers can cause connection hangs during shutdown. This article covers technical details, affected versions, impact, and mitigation strategies.

Published:

CVE-2022-27664 Overview

CVE-2022-27664 is a Denial of Service vulnerability in Go's net/http package affecting versions before 1.18.6 and 1.19.x before 1.19.1. The vulnerability allows attackers to cause a denial of service because an HTTP/2 connection can hang during closing if shutdown is preempted by a fatal error. This issue affects any Go application that accepts HTTP/2 connections.

Critical Impact

Remote attackers can exploit this vulnerability to cause HTTP/2 connections to hang indefinitely during the closing process, leading to service unavailability and resource exhaustion in affected Go applications.

Affected Products

  • Golang Go versions before 1.18.6
  • Golang Go version 1.19.0 (fixed in 1.19.1)
  • Fedora Project Fedora 36 and 37

Discovery Timeline

  • 2022-09-06 - CVE-2022-27664 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2022-27664

Vulnerability Analysis

This vulnerability exists in Go's net/http package, specifically in the HTTP/2 connection handling logic. The flaw occurs when an HTTP/2 connection is being closed and the shutdown process is interrupted by a fatal error. In this scenario, the connection enters a hung state rather than properly terminating, which can lead to resource exhaustion as connections accumulate without being properly released.

The attack can be executed remotely over the network without requiring any authentication or user interaction. The primary impact is on availability, as the vulnerability does not allow for data theft or system compromise but can effectively render services unavailable.

Root Cause

The root cause of this vulnerability lies in the improper handling of concurrent shutdown operations and fatal errors in the HTTP/2 connection management code within Go's net/http package. When a fatal error occurs during the shutdown sequence, the error handling logic fails to properly complete the connection closure, leaving the connection in a perpetually hanging state.

This race condition between the shutdown process and error handling results in connections that never complete their closure cycle, consuming system resources and potentially leading to denial of service as resources become exhausted.

Attack Vector

The attack vector for CVE-2022-27664 is network-based, requiring the attacker to establish HTTP/2 connections to the target server. An attacker can exploit this vulnerability by:

  1. Establishing multiple HTTP/2 connections to a vulnerable Go application
  2. Triggering conditions that cause fatal errors during connection shutdown
  3. Repeating this process to accumulate hanging connections
  4. Eventually exhausting server resources and causing denial of service

The vulnerability does not require authentication or special privileges, making it accessible to any remote attacker who can reach the HTTP/2 endpoint.

Detection Methods for CVE-2022-27664

Indicators of Compromise

  • Unusual accumulation of HTTP/2 connections in a half-closed or hanging state
  • Increasing memory consumption on Go-based HTTP/2 servers without corresponding traffic increases
  • Server performance degradation or unresponsiveness with HTTP/2 endpoints
  • Connection timeout errors reported by legitimate clients

Detection Strategies

  • Monitor Go application logs for HTTP/2 connection errors and shutdown failures
  • Implement connection state monitoring to detect abnormal connection lifecycle patterns
  • Use application performance monitoring (APM) tools to track HTTP/2 connection counts and states
  • Set up alerts for unusual spikes in connection counts or resource utilization

Monitoring Recommendations

  • Configure monitoring for Go application memory and connection metrics
  • Implement health checks that verify HTTP/2 endpoint responsiveness
  • Monitor system file descriptor usage on servers running vulnerable Go applications
  • Review server logs for patterns indicating connection handling anomalies

How to Mitigate CVE-2022-27664

Immediate Actions Required

  • Upgrade Golang to version 1.18.6 or later for the 1.18.x branch
  • Upgrade Golang to version 1.19.1 or later for the 1.19.x branch
  • Rebuild and redeploy all Go applications after upgrading the Go toolchain
  • Implement connection limits and timeouts as defense-in-depth measures

Patch Information

The Go team has released patched versions that address this vulnerability. Organizations should update their Go installations to the following minimum versions:

  • Go 1.18.6 for the 1.18.x release branch
  • Go 1.19.1 for the 1.19.x release branch

For detailed information about the fix, refer to the Golang Announcement Thread. Additionally, Linux distribution users should check for updated packages via their distribution's package manager. Fedora users can find relevant package updates in the Fedora Package Announcement.

Workarounds

  • Consider implementing a reverse proxy in front of Go applications to handle HTTP/2 connections
  • Configure connection timeouts and limits at the infrastructure level
  • Implement rate limiting for incoming HTTP/2 connections
  • Monitor and automatically restart Go services if resource exhaustion is detected
bash
# Configuration example - Setting connection limits in nginx as reverse proxy
http {
    # Limit concurrent HTTP/2 connections per IP
    limit_conn_zone $binary_remote_addr zone=http2_conn:10m;
    
    server {
        listen 443 ssl http2;
        
        # Apply connection limit
        limit_conn http2_conn 100;
        
        # Set keepalive timeout
        keepalive_timeout 60s;
        
        # Proxy to backend Go application
        location / {
            proxy_pass http://go_backend;
            proxy_http_version 1.1;
        }
    }
}

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.