CVE-2022-32148: Exposure of client IP addresses in net/http

stdlib Updated 02 Oct 2025

Summary

28/07/2022
Yes i
Unrated
Not published

CVE-2022-32148: Exposure of client IP addresses in net/http. Affects stdlib across 2 version ranges.

< 1.17.12 >= 1.18.0-0, < 1.18.4

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

Also tracked for

The same CVE-2022-32148 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 Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

The net/http package is a part of the Go standard library and provides a set of functions and types for building HTTP servers and clients. It is widely used for developing web applications and services in the Go ecosystem. This vulnerability specifically affects the handling of client IP addresses in the net/http package.

Vulnerability Detail

The vulnerability (CVE-2022-32148) arises from a flaw in the httputil.ReverseProxy.ServeHTTP function. When a Request.Header map contains a nil value for the X-Forwarded-For header, the ReverseProxy incorrectly sets the client IP as the value of the X-Forwarded-For header, contrary to its documentation. This can lead to unintentional exposure of client IP addresses. Even when a Director function sets the X-Forwarded-For header value to nil, the ReverseProxy leaves the header unmodified, which is not the expected behavior.

How To Fix

Latest published version: go1.25.5 as of 22 Oct 2026

go get stdlib@vgo1.25.5

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

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

  • < 1.17.12 1.17.12
    go get stdlib@v1.17.12
  • >= 1.18.0-0, < 1.18.4 1.18.4
    go get stdlib@v1.18.4

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

Workaround

If updating the Go version is not immediately feasible, a workaround can be implemented by manually modifying the ReverseProxy.ServeHTTP function to handle the X-Forwarded-For header correctly. Here is an example of a possible workaround:

func customServeHTTP(w http.ResponseWriter, r *http.Request) {
  if r.Header.Get("X-Forwarded-For") == "" {
    r.Header.Set("X-Forwarded-For", r.RemoteAddr)
  }
  // Rest of the code...
}

Conclusion

The exposure of client IP addresses in the net/http package can have significant privacy and security implications. It is crucial to update the affected Go version to ensure proper handling of the X-Forwarded-For header. If immediate updating is not possible, implementing the provided workaround can mitigate the vulnerability temporarily. For further support and assistance in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for stdlib →

Share this vulnerability

FAQ

This vulnerability can potentially expose client IP addresses, which may have privacy and security implications. It could allow an attacker to gather sensitive information about clients or perform IP-based attacks.

The vulnerability affects versions 0.x, 1.17.12, 1.18.0-0, and 1.18.4 of the Go standard library.

You can use the Vulert Playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability. It analyzes your Gopkg.lock file and provides real-time alerts for open-source vulnerabilities in your software.

Yes, the fix for this vulnerability is available in Go versions 1.17.12 and 1.18.4. It is recommended to update to these versions to ensure the proper handling of client IP addresses.

Yes, you can implement the provided workaround by manually modifying the ReverseProxy.ServeHTTP function to handle the X-Forwarded-For header correctly. However, updating to the fixed versions is still strongly recommended.

Related vulnerabilities

Recent vulnerabilities recorded for stdlib.

How To Fix

Latest published version: go1.25.5 as of 22 Oct 2026

go get stdlib@vgo1.25.5

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

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

  • < 1.17.12 1.17.12
    go get stdlib@v1.17.12
  • >= 1.18.0-0, < 1.18.4 1.18.4
    go get stdlib@v1.18.4

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