SEVERITY NOT PROVIDED EPSS 0.7% · 49th percentile

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

How to check your project

Automated analysis of the published advisory data, generated 2026-11-27. Not human-reviewed; verify against the official advisory. How this works.

Affected packages

EcosystemPackageAffected versionsFixed inUpgrade
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
When using Clang or GCC, building a malicious package that uses cgo could cause unexpected code execution at build time or write files to arbitrary directories via "-gen-*" or "-gnat*" flags in "#cgo" directives. The "-g*" wildcard in the compiler and linker flag allowlists previously matched Clang's two-argument "-gen-cdb-fragment-path <dir>" flag and GCC's two-argument "-gnatO <file>" flag, permitting compilation database fragments and sidecar output files to be written to arbitrary directories and desynchronizing flag argument parsing between the go command and the compiler driver so that subsequent arguments could be passed as unvalidated positional inputs to the linker. "-gen-*" and "-gnat*" flags are now disallowed in "#cgo" compiler and linker flags.

References

Source records: GO-2026-6856 (OSV.dev) · EPSS by FIRST, 2026-11-27.