CVE-2022-32190 Overview
CVE-2022-32190 is a path traversal vulnerability affecting the JoinPath and URL.JoinPath functions in the Go programming language's net/url package. These functions fail to properly sanitize ../ path elements when appended to a relative path, contrary to their documented behavior. For example, calling JoinPath("https://go.dev", "../go") returns the URL "https://go.dev/../go" instead of properly resolving and removing the parent directory traversal sequence.
This vulnerability is classified as CWE-22 (Improper Limitation of a Pathname to a Restricted Directory) and poses significant risks for applications that rely on these functions for URL construction and path sanitization.
Critical Impact
Applications using JoinPath or URL.JoinPath for URL construction may be vulnerable to path traversal attacks, potentially allowing attackers to access resources outside intended directories or bypass security controls that depend on proper URL normalization.
Affected Products
- Golang Go 1.19.0
- Golang Go 1.19.0-beta1
- Golang Go 1.19.0-rc1
- Golang Go 1.19.0-rc2
Discovery Timeline
- 2022-09-13 - CVE CVE-2022-32190 published to NVD
- 2024-11-21 - Last updated in NVD database
Technical Details for CVE-2022-32190
Vulnerability Analysis
The vulnerability exists in Go's net/url package where the JoinPath and URL.JoinPath functions do not correctly handle relative path elements containing parent directory traversal sequences (../). According to the Go documentation, these functions should normalize paths by removing ../ elements from the result. However, the implementation fails to do so when these elements are appended to a relative path.
This behavior creates a discrepancy between the documented functionality and actual implementation, which can lead to security issues in applications that depend on these functions to produce sanitized URLs. The vulnerability can be exploited over the network without requiring authentication or user interaction.
Root Cause
The root cause of this vulnerability is improper path normalization in the JoinPath implementation within Go's net/url package. When joining URL paths, the function should resolve and eliminate directory traversal sequences like ../ to prevent path manipulation. The vulnerable versions fail to perform this normalization step when the appended path contains leading ../ elements, leaving the traversal sequences intact in the resulting URL.
Attack Vector
The attack vector for this vulnerability is network-based. An attacker can exploit this vulnerability by providing malicious input containing ../ path elements to applications that use JoinPath or URL.JoinPath for URL construction. If the application expects these functions to sanitize path traversal sequences, the attacker may be able to:
- Access resources outside the intended directory structure
- Bypass URL-based access controls
- Manipulate API endpoints or file paths
- Conduct server-side request forgery (SSRF) attacks in certain configurations
The vulnerability is particularly dangerous in applications that construct URLs from user-controlled input and rely on the documented sanitization behavior of these functions.
Detection Methods for CVE-2022-32190
Indicators of Compromise
- Unusual URL patterns in application logs containing unresolved ../ sequences
- Requests to unexpected paths or resources outside normal application scope
- Access log entries showing path traversal attempts that were not properly blocked
- Error logs indicating file access outside expected directories
Detection Strategies
- Review application source code for usage of JoinPath or URL.JoinPath functions with user-controlled input
- Implement web application firewall (WAF) rules to detect and block requests containing ../ sequences
- Monitor HTTP request logs for path traversal patterns in URLs
- Use static analysis tools to identify vulnerable Go code patterns
Monitoring Recommendations
- Enable detailed logging for URL construction and request routing in Go applications
- Monitor for anomalous access patterns to resources outside normal application directories
- Implement alerting for detection of path traversal sequences in request URLs
- Review application behavior when processing URLs containing relative path elements
How to Mitigate CVE-2022-32190
Immediate Actions Required
- Upgrade Go to a patched version that addresses this vulnerability
- Review all application code for usage of JoinPath and URL.JoinPath functions
- Implement additional input validation to sanitize path traversal sequences before URL construction
- Add security testing to verify proper URL normalization behavior
Patch Information
The Go development team has released patches to address this vulnerability. Review the following resources for patch details:
- Go Change List 423514 - Contains the fix for this vulnerability
- Go Issue 54385 - Detailed issue tracker entry
- Go Vulnerability Report GO-2022-0988 - Official vulnerability documentation
- Golang Announce Mailing List - Security announcement
Workarounds
- Implement manual path normalization using path.Clean() on URL paths before using JoinPath
- Validate and sanitize all user-controlled input before incorporating it into URL construction
- Use custom URL building functions that explicitly handle and remove ../ sequences
- Consider using filepath.Clean() for file path operations as an additional safeguard
# Check your Go version to determine if you're affected
go version
# Update Go to the latest patched version
# For Linux/macOS:
go install golang.org/dl/go1.19.1@latest
go1.19.1 download
# Verify the update
go version
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


