CVE-2022-32148: Vulnerability in stdlib package - Improper exposure of client IP addresses in net/http/httputil: NewSingleHostReverseProxy

golang-1.15 Updated 02 Oct 2025

Summary

10/08/2022
N/A
No i
Medium
6.5

CVE-2022-32148: Improper exposure of client IP addresses in net/http before Go 1.17.12 and Go 1.18.4 can be triggered by calling httputil.ReverseProxy.ServeHTTP with a Request.Header map containing a nil value for the X-Forwarded-For he... Affects golang-1.15 versions < 1ed3c127daceaffb9aadc806ba60f0b51b47421b. No fix is published. How to fix ↓

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

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The stdlib package is a part of the Go programming language standard library. It provides a collection of commonly used functions and types that are essential for building Go applications. The net/http/httputil package within stdlib offers utilities for HTTP request/response handling, including the NewSingleHostReverseProxy function. This vulnerability affects versions 1.18.2 of the stdlib package.

Vulnerability Detail

The vulnerability, identified as CVE-2022-32148, arises from improper exposure of client IP addresses in the net/http package before Go 1.17.12 and Go 1.18.4. It can be triggered by calling the NewSingleHostReverseProxy function with a Request.Header map containing a nil value for the X-Forwarded-For header. This causes the ReverseProxy to set the client IP as the value of the X-Forwarded-For header. The exposure of client IP addresses can lead to potential security risks, such as IP address spoofing and unauthorized access.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As a workaround, developers can manually modify the Request.Header map to ensure that the X-Forwarded-For header is not set to a nil value before calling the NewSingleHostReverseProxy function. Here is an example code snippet:

req.Header.Del("X-Forwarded-For")

Conclusion

In conclusion, the stdlib package in Go versions before 1.17.12 and 1.18.4 is vulnerable to improper exposure of client IP addresses. This can lead to security risks such as IP address spoofing and unauthorized access. It is recommended to update the stdlib package to the fixed versions or apply the provided workaround. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for golang-1.15 →

Share this vulnerability

FAQ

The vulnerability exposes client IP addresses, which can be exploited for IP address spoofing and unauthorized access.

Versions before Go 1.17.12 and Go 1.18.4 are affected by this vulnerability.

You can use the Vulert Playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability. Simply upload your manifest file (e.g., package-lock.json) and Vulert will provide real-time alerts for open-source vulnerabilities in your software.

There are no known exploits for this vulnerability at the time of this report. However, it is crucial to apply the recommended fixes to mitigate potential risks.

You can find more information about this vulnerability in the National Vulnerability Database (NVD) entry: https://nvd.nist.gov/vuln/detail/CVE-2022-32148

Related vulnerabilities

Recent vulnerabilities recorded for golang-1.15.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. 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