CVE-2026-97035: Unexpected code execution and arbitrary file write via Clang -gen-* and GCC -gnat* flags in cgo in cmd/go
Published 2026-11-11 · Updated 2026-11-27 · Also known as BIT-golang-2026-97035, GO-2026-6856
Summary
A vulnerability in the Go toolchain's cgo directive handling allows unexpected code execution at build time and arbitrary file writes when building malicious packages using Clang or GCC. Engineering and security teams managing Go development environments must update their toolchains.
Who is affected
Affected deployments include environments using Go toolchain versions prior to 1.26.11 and versions 1.27.0 through 1.27.3. The vulnerability is triggered when building a malicious package that uses cgo and includes specific unintended Clang '-gen-*' or GCC '-gnat*' flags in '#cgo' directives, which bypass previous allowlist checks and permit desynchronized flag parsing.
Exploitability
The severity is currently unknown with no CVSS vector provided, and the CISA Known Exploited Vulnerabilities list marks active exploitation as no. The EPSS score is 0.007 with a percentile of 0.490.
Remediation
- Upgrade the Go toolchain to version 1.26.11 or later for the 1.26 branch.
- Upgrade the Go toolchain to version 1.27.4 or later for the 1.27 branch.
How to check your project
- Check the installed Go toolchain version by running 'go version'.
- Audit codebase '#cgo' directives for any disallowed '-gen-*' or '-gnat*' compiler and linker flags.
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 CVE-2026-97035?
The vulnerability is caused by overly permissive '-g*' wildcards in compiler and linker flag allowlists that matched Clang's '-gen-cdb-fragment-path' and GCC's '-gnatO' flags within '#cgo' directives.
Which versions of Go are affected?
Go toolchain versions introduced prior to fixed version 1.26.11, and versions introduced from 1.27.0-0 up to fixed version 1.27.4 are affected.
Is there active exploitation in the wild?
No, CISA Known Exploited Vulnerabilities indicates no active exploitation.
Original advisory description
References
- FIX https://go.dev/cl/862148
- REPORT https://go.dev/issue/82575
- WEB https://groups.google.com/g/golang-announce/c/iY8TY0wWgbM
Source records: GO-2026-6856 (OSV.dev) · EPSS by FIRST, 2026-11-27.