Go Toolchain: cgo LDFLAGS validation bypass and denial of service (CVE-2026-97043)
The Go toolchain is vulnerable to a linker flag injection and potential code execution during build time due to improper quote handling in //go:cgo_ldflag directives, alongside a secondary denial-of-service vulnerability in the LDFLAGS deduplication logic.
CVE search metadata
CVE search record: CVE-2026-97043. Severity: high. CVSS: 8.8. EPSS: 0.57%. KEV: no. Product: cmd/compile (< 1.26.11, 1.27.0-0 to 1.27.3), cmd/go (< 1.26.11, 1.27.0-0 to 1.27.3). Brief: Go Toolchain: cgo LDFLAGS validation bypass and denial of service (CVE-2026-97043). Brief link: https://feed.craftedsignal.io/briefs/2026-11-cve-2026-97043/
Triage facts
Revision 1- Applicability
- cmd/compile (< 1.26.11, 1.27.0-0 to 1.27.3), cmd/go (< 1.26.11, 1.27.0-0 to 1.27.3)
- Evidence
- Unknown
- Severity
- High
- Action
- Elevated
- Sources
- 2 public sources
- Freshness
- Revision 1Nov 19, 20:22 UTC
- Vulnerabilities
- 1 CVE
- Source quality
- A1Very likely
Overview
The Go toolchain, specifically the cmd/go and cmd/compile components, contains a vulnerability (CVE-2026-97043) that allows an attacker to bypass #cgo LDFLAGS validation when building a malicious package. This occurs because the toolchain incorrectly parses //go:cgo_ldflag directives by splitting on raw quote characters without correctly handling backslash escapes or performing proper unquoting. An attacker can exploit this to smuggle disallowed linker flags or unvalidated search paths into the external linker.
Additionally, the deduplication logic for LDFLAGS in the go command can trigger an out-of-bounds slice index error, resulting in a panic (denial of service) when a prefix of the flag list matches near the end of the slice. The issue has been addressed by updating cmd/compile and cmd/go to properly handle backslash-escaped quotes, implement proper unquoting via strconv.Unquote, and fix the slice bounds check in processCgoOutputs.
Impact
Successful exploitation of the linker flag injection can lead to arbitrary code execution at build time on the developer's machine or the build server. The separate flaw in the deduplication logic can cause compilation to fail, resulting in a denial-of-service condition.
Recommendation
- Update Go installations to version 1.26.11 or later for the 1.26 branch, or 1.27.4 or later for the 1.27 branch.
- Audit build pipelines that process untrusted Go modules, especially those utilizing cgo, to ensure they run in isolated or sandboxed environments.
- Implement CI/CD security controls to verify the integrity of external Go dependencies before inclusion in the build process.
Threat Hunt
Identify build-time execution of the 'go' toolchain on build servers or developer workstations where the 'cgo' capability is enabled, specifically monitoring for instances where source code contains '#cgo LDFLAGS' directives with complex quoting or backslash-escaped characters.
Data: Process execution logs (command line arguments), File integrity monitoring or source code repository scanner logs, Build server stdout/stderr logs for compiler diagnostics
Mitigations
Upgrade Go toolchain to version 1.26.11 or 1.27.4 as specified in the CVE data.
Gaps
- No specific log-observable IOCs or process-creation triggers available for immediate automated detection; focus on patch management and build pipeline isolation.