CVE-2023-45285
📋 TL;DR
This CVE describes a protocol downgrade vulnerability in Go's module fetching system. When using 'go get' with a module ending in '.git', the system may fall back to the insecure 'git://' protocol if secure protocols fail, potentially exposing users to man-in-the-middle attacks. This affects Go developers who fetch modules directly without using the module proxy (GOPROXY=off).
💻 Affected Systems
- Go programming language
📦 What is this software?
Go by Golang
Go by Golang
⚠️ Risk & Real-World Impact
Worst Case
Attackers could perform man-in-the-middle attacks to inject malicious code into dependencies, leading to supply chain compromise, remote code execution, or data exfiltration.
Likely Case
Attackers in privileged network positions could intercept and modify module downloads, potentially introducing backdoors or malware into development environments.
If Mitigated
With proper controls like using module proxies or setting GOINSECURE appropriately, the risk is limited to specific development scenarios with network-level attacks.
🎯 Exploit Status
Exploitation requires network-level access to intercept git:// protocol traffic and specific conditions where secure protocols fail for '.git' suffixed modules.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Go 1.21.5 and Go 1.20.12
Vendor Advisory: https://go.dev/issue/63845
Restart Required: No
Instructions:
1. Update Go to version 1.21.5 or 1.20.12 or later. 2. Run 'go version' to verify update. 3. Rebuild any affected projects to ensure secure module fetching.
🔧 Temporary Workarounds
Use Module Proxy
allConfigure Go to use the module proxy instead of fetching modules directly
export GOPROXY=https://proxy.golang.org,direct
Avoid Direct Git Fetching
allConfigure Go to avoid insecure protocols for specific domains
export GOINSECURE=example.com
🧯 If You Can't Patch
- Always use the module proxy (set GOPROXY=https://proxy.golang.org,direct)
- Avoid using 'go get' with modules that have '.git' suffix in their import paths
🔍 How to Verify
Check if Vulnerable:
Check if using Go version before 1.21.5 or 1.20.12 and if fetching modules directly with GOPROXY=off
Check Version:
go version
Verify Fix Applied:
Verify Go version is 1.21.5, 1.20.12 or later using 'go version'
📡 Detection & Monitoring
Log Indicators:
- git:// protocol usage in Go module fetch logs
- Failed HTTPS/git+ssh attempts followed by git:// connections
Network Indicators:
- git:// protocol traffic on port 9418 from Go processes
- Unencrypted git traffic to unexpected destinations
SIEM Query:
process:go AND (network.protocol:git OR destination.port:9418)
🔗 References
- https://go.dev/cl/540257
- https://go.dev/issue/63845
- https://groups.google.com/g/golang-dev/c/6ypN5EjibjM/m/KmLVYH_uAgAJ
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/UIU6HOGV6RRIKWM57LOXQA75BGZSIH6G/
- https://pkg.go.dev/vuln/GO-2023-2383
- https://go.dev/cl/540257
- https://go.dev/issue/63845
- https://groups.google.com/g/golang-dev/c/6ypN5EjibjM/m/KmLVYH_uAgAJ
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/UIU6HOGV6RRIKWM57LOXQA75BGZSIH6G/
- https://pkg.go.dev/vuln/GO-2023-2383