CVE-2023-29404
📋 TL;DR
This vulnerability in Go's cgo build system allows malicious Go modules to execute arbitrary code during the build process. Attackers can smuggle dangerous linker flags through LDFLAGS sanitization when building untrusted code. Anyone using 'go get' or building untrusted Go modules with cgo is affected.
💻 Affected Systems
- Go programming language
📦 What is this software?
Fedora by Fedoraproject
Go by Golang
Go by Golang
⚠️ Risk & Real-World Impact
Worst Case
Full system compromise via arbitrary code execution during build, potentially leading to supply chain attacks, credential theft, and persistent backdoors.
Likely Case
Build system compromise leading to malware injection into compiled binaries or build environment takeover.
If Mitigated
Limited to build sandbox escape if proper isolation is in place, but still dangerous for CI/CD pipelines.
🎯 Exploit Status
Exploitation requires convincing users to build malicious modules. The vulnerability is well-documented with proof-of-concept available in the Go issue tracker.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Go 1.20.5 or Go 1.19.10
Vendor Advisory: https://groups.google.com/g/golang-announce/c/q5135a9d924/m/j0ZoAJOHAwAJ
Restart Required: No
Instructions:
1. Download and install Go 1.20.5 or 1.19.10 from https://go.dev/dl/ 2. Replace existing Go installation 3. Rebuild any affected binaries
🔧 Temporary Workarounds
Disable cgo for untrusted builds
allSet CGO_ENABLED=0 to disable cgo when building untrusted code
CGO_ENABLED=0 go build
CGO_ENABLED=0 go get
Use Go modules proxy with validation
allConfigure GOPROXY to use a trusted proxy that validates modules
export GOPROXY=https://proxy.golang.org,direct
🧯 If You Can't Patch
- Avoid building untrusted Go modules entirely
- Isolate build environments using containers or VMs with minimal privileges
🔍 How to Verify
Check if Vulnerable:
Run 'go version' and check if version is between 1.20.0-1.20.4 or 1.19.0-1.19.9
Check Version:
go version
Verify Fix Applied:
Run 'go version' and confirm version is 1.20.5+ or 1.19.10+
📡 Detection & Monitoring
Log Indicators:
- Unexpected build failures with cgo
- Unusual linker flag usage in build logs
- Build processes spawning unexpected child processes
Network Indicators:
- Go tools downloading from untrusted sources
- Unexpected outbound connections during build process
SIEM Query:
process_name:"go" AND (cmdline:"get" OR cmdline:"build") AND (parent_process contains "cgo" OR cmdline contains "LDFLAGS")
🔗 References
- https://go.dev/cl/501225
- https://go.dev/issue/60305
- https://groups.google.com/g/golang-announce/c/q5135a9d924/m/j0ZoAJOHAwAJ
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/NZ2O6YCO2IZMZJELQGZYR2WAUNEDLYV6/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/XBS3IIK6ADV24C5ULQU55QLT2UE762ZX/
- https://pkg.go.dev/vuln/GO-2023-1841
- https://security.gentoo.org/glsa/202311-09
- https://go.dev/cl/501225
- https://go.dev/issue/60305
- https://groups.google.com/g/golang-announce/c/q5135a9d924/m/j0ZoAJOHAwAJ
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/NZ2O6YCO2IZMZJELQGZYR2WAUNEDLYV6/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/XBS3IIK6ADV24C5ULQU55QLT2UE762ZX/
- https://pkg.go.dev/vuln/GO-2023-1841
- https://security.gentoo.org/glsa/202311-09
- https://security.netapp.com/advisory/ntap-20241115-0009/