CVE-2021-33197: Arbitrary Header Dropping Vulnerability in golang

golang Updated 02 Oct 2025

Summary

06/03/2024
Yes i
Medium
Not published

CVE-2021-33197: In Go before 1.15.13 and 1.16.x before 1.16.5, some configurations of ReverseProxy (from net/http/httputil) result in a situation where an attacker is able to drop arbitrary headers. Affects golang across 2 version ranges.

< 1.15.13 >= 1.16.0, < 1.16.5

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

Also tracked for

The same CVE-2021-33197 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 Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Golang is an open-source programming language that is widely used for building efficient and reliable software. It provides a rich set of libraries and tools for various purposes. The ReverseProxy configuration in the net/http/httputil package allows developers to create HTTP reverse proxies. However, certain configurations of ReverseProxy in Go versions before 1.15.13 and 1.16.x before 1.16.5 are vulnerable to an arbitrary header dropping attack.

Vulnerability Detail

The vulnerability (CVE-2021-33197) arises due to a flaw in the ReverseProxy implementation. Attackers can exploit this vulnerability to drop arbitrary headers, potentially leading to various security issues. By manipulating the ReverseProxy configurations, an attacker can selectively drop headers, which may result in bypassing security controls, information leakage, or other unexpected behavior.

How To Fix

Fixed versions by release line

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

  • < 1.15.13 1.15.13
  • >= 1.16.0, < 1.16.5 1.16.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 temporary workaround, developers can manually validate and filter headers before passing them to the ReverseProxy. By implementing custom header validation logic, it is possible to mitigate the risk of arbitrary header dropping. Here's an example of how to validate headers in Go:

func validateHeaders(headers http.Header) http.Header {
  validHeaders := make(http.Header)

  for key, values := range headers {
    // Add custom validation logic here
    if isValidHeader(key, values) {
      validHeaders[key] = values
    }
  }

  return validHeaders
}

By using the validateHeaders function to filter headers before passing them to ReverseProxy, developers can prevent the vulnerability from being exploited.

Conclusion

In conclusion, the arbitrary header dropping vulnerability in golang's ReverseProxy configuration can be exploited by attackers to manipulate headers and potentially bypass security controls or leak sensitive information. It is crucial to update to the fixed versions and implement proper header validation to mitigate this vulnerability. For further assistance or support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for golang →

Share this vulnerability

FAQ

This vulnerability allows attackers to drop arbitrary headers, which can lead to security bypasses, information leakage, or unexpected behavior in the affected application.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability. Simply upload your manifest file (e.g., package-lock.json) and Vulert will analyze it for any open-source vulnerabilities, including this one.

No, only versions before 1.15.13 and 1.16.x before 1.16.5 are affected. It is recommended to update to the fixed versions to mitigate the vulnerability.

Yes, developers can manually validate and filter headers before passing them to the ReverseProxy. By implementing custom header validation logic, the risk of arbitrary header dropping can be mitigated.

You can find more information about this vulnerability, including technical details and the fixed versions, in the vulnerability report at https://github.com/bitnami/vulndb/tree/main/data/golang/BIT-golang-2021-33197.json

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.15.13 1.15.13
  • >= 1.16.0, < 1.16.5 1.16.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