CVE-2020-28367
📋 TL;DR
This CVE allows arbitrary code execution during build time when using Go's cgo feature with malicious gcc flags specified in #cgo directives. Attackers can inject code that runs when compiling Go programs that use cgo. This affects developers building Go applications with cgo enabled before Go 1.14.12 or 1.15.5.
💻 Affected Systems
- Go programming language
📦 What is this software?
Go by Golang
Go by Golang
⚠️ Risk & Real-World Impact
Worst Case
Complete compromise of build systems leading to supply chain attacks, backdoored binaries, and lateral movement from build infrastructure.
Likely Case
Malicious actors injecting backdoors into compiled binaries during CI/CD pipelines or developer builds.
If Mitigated
Limited to controlled build environments with restricted network access and code review processes.
🎯 Exploit Status
Exploitation requires ability to modify Go source code with #cgo directives. Public proof-of-concept exists in Go issue tracker.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Go 1.14.12 or Go 1.15.5
Vendor Advisory: https://groups.google.com/g/golang-announce/c/NpBGTTmKzpM
Restart Required: No
Instructions:
1. Download latest Go version from official site. 2. Uninstall old Go version. 3. Install patched version. 4. Rebuild any affected binaries.
🔧 Temporary Workarounds
Disable cgo builds
allBuild Go programs without cgo support to avoid vulnerability
CGO_ENABLED=0 go build
Restrict build environment
allRun builds in isolated containers with minimal privileges
🧯 If You Can't Patch
- Audit all Go source code for suspicious #cgo directives
- Implement strict code review for any Go code using cgo features
🔍 How to Verify
Check if Vulnerable:
Check Go version: if using Go <1.14.12 or Go 1.15.x <1.15.5 and building with cgo enabled, you are vulnerable.
Check Version:
go version
Verify Fix Applied:
Verify Go version is 1.14.12+ or 1.15.5+ and test building with cgo using known malicious patterns.
📡 Detection & Monitoring
Log Indicators:
- Unusual gcc flag patterns in build logs
- Build failures with unexpected compiler errors
Network Indicators:
- Unexpected network connections from build processes
SIEM Query:
process:go AND cmdline:*cgo* AND (version:<1.14.12 OR version:1.15.[0-4])
🔗 References
- https://go.dev/cl/267277
- https://go.dev/issue/42556
- https://go.googlesource.com/go/+/da7aa86917811a571e6634b45a457f918b8e6561
- https://groups.google.com/g/golang-announce/c/NpBGTTmKzpM
- https://lists.debian.org/debian-lts-announce/2023/04/msg00021.html
- https://pkg.go.dev/vuln/GO-2022-0476
- https://go.dev/cl/267277
- https://go.dev/issue/42556
- https://go.googlesource.com/go/+/da7aa86917811a571e6634b45a457f918b8e6561
- https://groups.google.com/g/golang-announce/c/NpBGTTmKzpM
- https://lists.debian.org/debian-lts-announce/2023/04/msg00021.html
- https://pkg.go.dev/vuln/GO-2022-0476