You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cmd/go: unexpected code execution and arbitrary file write via Clang -gen-* and GCC -gnat* flags in cgo #82575
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
" flag and GCC's
two-argument "-gnatO " 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.
This issue was found by the Go Security Team during an internal audit.
changed the title [-]security: fix CVE-2026-97035[/-][+]cmd/go: unexpected code execution and arbitrary file write via Clang -gen-* and GCC -gnat* flags in cgo[/+]on Nov 10, 2026
Activity
nicholashusin commentedon Oct 26, 2026
Hi @gopherbot, please open backport issues for this security issue.
gopherbot commentedon Oct 26, 2026
Backport issue(s) opened: #82595 (for 1.26), #82596 (for 1.27).
Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases.
gopherbot commentedon Nov 10, 2026
Change https://go.dev/cl/861486 mentions this issue:
[release-branch.go1.27] cmd/go: disallow -gen-* and -gnat* in flag allowlistsgopherbot commentedon Nov 10, 2026
Change https://go.dev/cl/861525 mentions this issue:
[release-branch.go1.26] cmd/go: disallow -gen-* and -gnat* in flag allowlists[release-branch.go1.27] cmd/go: disallow -gen-* and -gnat* in flag al…
[release-branch.go1.26] cmd/go: disallow -gen-* and -gnat* in flag al…
[-]security: fix CVE-2026-97035[/-][+]cmd/go: unexpected code execution and arbitrary file write via Clang -gen-* and GCC -gnat* flags in cgo[/+]gopherbot commentedon Nov 10, 2026
Change https://go.dev/cl/862148 mentions this issue:
cmd/go: disallow -gen-* and -gnat* in flag allowlistscmd/go: disallow -gen-* and -gnat* in flag allowlists