Go toolchain: Arbitrary library reference vulnerability in cmd/cgo and cmd/link (CVE-2026-97042)
The Go toolchain on Windows contains a vulnerability in cmd/cgo, cmd/compile, and cmd/link where insufficient validation of library names and imported DLLs allows for path traversal and arbitrary file references during compilation.
CVE search metadata
CVE search record: CVE-2026-97042. Severity: high. CVSS: 8.8. EPSS: 0.45%. KEV: no. Product: cmd/cgo, cmd/compile, cmd/link. Brief: Go toolchain: Arbitrary library reference vulnerability in cmd/cgo and cmd/link (CVE-2026-97042). Brief link: https://feed.craftedsignal.io/briefs/2026-11-go-toolchain-linker-vulnerability-cve-2026-97042/
Triage facts
Revision 1- Applicability
- cmd/cgo, cmd/compile +1
- Evidence
- Unknown
- Severity
- High
- Sources
- 2 public sources
- Freshness
- Revision 1Nov 19, 20:22 UTC
- Vulnerabilities
- 1 CVE
- Source quality
- A2Roughly even chance
Overview
The Go toolchain's compiler and linker perform insufficient validation on library names and imported DLLs on Windows. Specifically, the compiler fails to adequately validate library names within "//go:cgo_import_dynamic" directives, and "cmd/cgo" and "cmd/link" fail to sanitize imported DLL names from PE object files. An attacker can craft a malicious package or PE object file to supply dangerous arguments to the external linker, enabling path traversal (via "..") or the injection of special characters to reference unintended files on disk.
Impact
Exploitation allows for the referencing of arbitrary files on disk through path traversal or special characters when using affected versions of the Go toolchain on Windows.
Recommendation
Upgrade the Go toolchain to version 1.26.11 or later for the 1.26 branch, or to 1.27.4 or later for the 1.27 branch, which implement stricter validation of library names and rejection of unsafe characters and path traversals.