CVE-2026-97043: Unexpected code execution via escaped quotes in //go:cgo_ldflag in cmd/go and cmd/compile
Published 2026-11-11 · Updated 2026-11-27 · Also known as BIT-golang-2026-97043, GO-2026-6848
Summary
A vulnerability in the Go toolchain allows arbitrary code execution or process crashes during the build process via crafted //go:cgo_ldflag directives. Go developers and build environment administrators should update their toolchains to the corrected versions immediately.
Who is affected
The vulnerability affects projects using cgo where malicious packages can bypass linker flag validation through improper quote handling in pragmas. This can lead to the injection of disallowed linker flags, unauthorized search paths, or an out-of-bounds panic in the go command. The flaw is triggered at build time when compiling malicious or untrusted packages.
Exploitability
The severity and CVSS vector are not documented, though the EPSS score of 0.007 indicates a low predicted probability of exploitation. CISA KEV status is no, confirming there is no evidence of active exploitation in the wild.
Remediation
- Upgrade Go toolchain to version 1.26.11 or later.
- Upgrade Go toolchain to version 1.27.4 or later if using the 1.27.x branch.
How to check your project
- Run 'go version' to check the currently active Go toolchain version.
- Audit project dependencies for untrusted third-party packages that utilize cgo directives.
Automated analysis of the published advisory data, generated 2026-11-27. Not human-reviewed; verify against the official advisory. How this works.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | Upgrade |
|---|---|---|---|---|
| Go | toolchain |
>= 0, < 1.26.11 | 1.26.11 | go get [email protected] |
| Go | toolchain |
>= 1.27.0-0, < 1.27.4 | 1.27.4 | go get [email protected] |
FAQ
What is the primary cause of this vulnerability?
The vulnerability is caused by a mismatch in how cmd/cgo quotes #cgo LDFLAGS arguments and how cmd/compile and cmd/go parse the resulting //go:cgo_ldflag directives, leading to improper handling of backslash escapes.
Does this flaw affect the Go runtime code?
No, the vulnerability is specific to the build-time tools, specifically the cmd/go and cmd/compile components of the Go toolchain.
What happens if the go command encounters the slice bounds error?
If the deduplication of LDFLAGS triggers the out-of-bounds slice index error, the go command will panic, resulting in a build failure.
Original advisory description
References
- FIX https://go.dev/cl/862156
- REPORT https://go.dev/issue/82567
- WEB https://groups.google.com/g/golang-announce/c/iY8TY0wWgbM
Source records: GO-2026-6848 (OSV.dev) · EPSS by FIRST, 2026-11-27.