CVE-2026-97033: Unexpected code execution via --sysroot, -target, -isysroot, -Wl,-syslibroot, and -x cgo flags in cmd/go
Published 2026-11-11 · Updated 2026-11-27 · Also known as BIT-golang-2026-97033, GO-2026-6858
Summary
A vulnerability in the Go toolchain's cgo directive handling allows unexpected code execution at build time through malicious compiler and linker flags. Developers and security teams using Go toolchains should update to the patched versions.
Who is affected
Building a malicious package that leverages cgo can trigger arbitrary code execution at build time when processing flags such as --sysroot, -target, -isysroot, -Wl,-syslibroot, and -x. This affects deployments utilizing vulnerable Go toolchain versions to compile untrusted packages containing #cgo directives.
Exploitability
The vulnerability has an EPSS score of 0.007 (47.9th percentile) indicating low current probability of exploitation in the wild. It is not currently listed in the CISA Known Exploited Vulnerabilities catalog, and a CVSS vector is not documented.
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
- Check the installed Go toolchain version by running 'go version'.
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 causes the unexpected code execution?
Building a malicious package using cgo permits dangerous compiler and linker flags within #cgo directives that manipulate paths, invoke helper tools from the working directory, interpret files as linker scripts, or change input languages.
Which flags are restricted or disallowed by the fix?
--sysroot and -target are disallowed, -isysroot and -Wl,-syslibroot are verified not to point to regular files, and -x is restricted to supported languages.
What versions fix this vulnerability?
Versions 1.26.11 and 1.27.4 of the Go toolchain contain the fixes for this issue.
Original advisory description
References
- FIX https://go.dev/cl/862146
- REPORT https://go.dev/issue/82577
- WEB https://groups.google.com/g/golang-announce/c/iY8TY0wWgbM
Source records: GO-2026-6858 (OSV.dev) · EPSS by FIRST, 2026-11-27.