CVE-2023-45285 Overview
CVE-2023-45285 is an insecure communication vulnerability in Golang Go that affects the go get command when fetching modules with the .git suffix. When a module is unavailable via secure protocols (https:// and git+ssh://), the Go toolchain may unexpectedly fall back to the insecure git:// protocol, even when the GOINSECURE environment variable is not set for that module. This vulnerability specifically impacts users who have disabled the Go module proxy (GOPROXY=off) and are fetching modules directly from version control systems.
Critical Impact
Attackers performing man-in-the-middle attacks could intercept and modify Go module source code during fetch operations, potentially injecting malicious code into developer environments and build pipelines.
Affected Products
- Golang Go (versions prior to patch)
Discovery Timeline
- 2023-12-06 - CVE-2023-45285 published to NVD
- 2024-11-21 - Last updated in NVD database
Technical Details for CVE-2023-45285
Vulnerability Analysis
This vulnerability represents a protocol downgrade issue in the Go module fetching mechanism. When developers use go get to retrieve a module with a .git suffix, the toolchain attempts to clone the repository using secure protocols first. However, if both https:// and git+ssh:// protocols fail (due to network issues, misconfiguration, or server-side problems), the system silently falls back to the unencrypted git:// protocol.
The git:// protocol transmits all data in plaintext, making it susceptible to network-level attacks. This is particularly dangerous because developers may be unaware that their module fetches are occurring over an insecure channel, as the GOINSECURE flag was not explicitly set.
Root Cause
The root cause lies in the Go toolchain's module resolution logic for repositories with the .git suffix. The protocol fallback mechanism does not properly respect the implicit security expectations when GOINSECURE is not configured. The logic should only allow insecure protocol usage when explicitly permitted, but instead defaults to attempting git:// as a last resort regardless of the GOINSECURE setting.
Attack Vector
This vulnerability is exploitable via network-based attacks. An attacker positioned to intercept network traffic (man-in-the-middle) could:
- Block or disrupt HTTPS and SSH connections to the target Git repository
- Wait for the Go toolchain to fall back to the insecure git:// protocol
- Intercept the plaintext Git traffic and inject malicious code into the module being fetched
- The developer unknowingly receives compromised code that appears to come from the legitimate source
The attack requires the target to be fetching modules directly (GOPROXY=off) and using module paths with the .git suffix. In environments such as corporate networks, public Wi-Fi, or compromised ISP infrastructure, this attack becomes feasible for determined adversaries targeting software supply chains.
Detection Methods for CVE-2023-45285
Indicators of Compromise
- Unexpected git:// protocol connections in network traffic logs during Go module fetches
- Module fetch operations completing successfully despite HTTPS/SSH connectivity issues to Git servers
- Network traffic analysis showing plaintext Git protocol data on port 9418
- Build logs indicating module retrieval from git:// URLs when GOINSECURE was not configured
Detection Strategies
- Monitor network traffic for outbound connections using the git:// protocol (typically port 9418) from development machines and CI/CD systems
- Implement network-level logging and alerting for unencrypted Git protocol usage in environments where Go development occurs
- Review Go build logs for evidence of protocol fallback behavior during module fetches
- Deploy endpoint detection to monitor go get command execution and associated network connections
Monitoring Recommendations
- Configure network firewalls to log and optionally block outbound git:// protocol traffic from development environments
- Implement SentinelOne Singularity Platform to monitor Go toolchain behavior and detect anomalous network communications
- Set up alerts for unexpected protocol usage patterns during software build processes
- Regularly audit GOPROXY and GOINSECURE configurations across development environments
How to Mitigate CVE-2023-45285
Immediate Actions Required
- Update Golang Go to the latest patched version that addresses this protocol fallback issue
- Ensure GOPROXY is configured to use the Go module proxy (default behavior) rather than direct fetches
- Review and audit any .git suffix module dependencies in your Go projects
- Configure network policies to block outbound git:// protocol connections from build environments
Patch Information
The Go team has released a fix for this vulnerability. Users should update to the latest stable version of Go. For detailed patch information, refer to the Go.dev Change Log and the Go.dev Issue Tracker. Additional details can be found in the Go.dev Vulnerability Notice and the Golang Dev Group Discussion. Fedora users should also check the Fedora Package Announcement for distribution-specific updates.
Workarounds
- Enable the Go module proxy by removing GOPROXY=off from your environment configuration or explicitly setting GOPROXY=https://proxy.golang.org,direct
- Use GOINSECURE only for explicitly trusted internal repositories and never for public modules
- Configure network firewalls to block outbound connections on port 9418 (git protocol) from development and CI/CD systems
- Consider using SSH-based module fetching with proper key management for private repositories
# Recommended environment configuration to mitigate the vulnerability
# Enable the Go module proxy (default and secure)
export GOPROXY=https://proxy.golang.org,direct
# Ensure GOINSECURE is not set or only includes trusted internal hosts
unset GOINSECURE
# Alternatively, for private repos, use GOPRIVATE with proper Git config
export GOPRIVATE=git.internal.company.com
# Configure Git to always use HTTPS instead of git:// protocol
git config --global url."https://".insteadOf git://
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


