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 via --sysroot, -target, -isysroot, -Wl,-syslibroot, and -x cgo flags #82577
Building a malicious package that uses cgo could cause arbitrary code execution
at build time through several compiler and linker flags permitted in "#cgo"
directives.
Specifically, "--sysroot" in GCC and Clang relocates compiler subprograms, spec
files, and CRT startup objects to an attacker-controlled directory; "-target" in
Clang falls back to executing target helper tools from the current working
directory when not found in PATH; "-isysroot" and "-Wl,-syslibroot" can pass a
regular file on disk to GNU ld.bfd, which interprets it as a positional linker
script; and "-x" permitted specifying arbitrary compiler input languages beyond
those supported by cgo.
"--sysroot" and "-target" are now disallowed in "#cgo" flags, "-isysroot" and
"-Wl,-syslibroot" are verified not to point to regular files, and "-x" is
restricted to the C, C++, Objective-C, and assembler languages supported by cgo.
This issue was found by the Go Security Team during an internal audit.
changed the title [-]security: fix CVE-2026-97033[/-][+]cmd/go: unexpected code execution via --sysroot, -target, -isysroot, -Wl,-syslibroot, and -x cgo flags[/+]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: #82599 (for 1.26), #82600 (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/861484 mentions this issue:
[release-branch.go1.27] cmd/go: disallow --sysroot and -target, validate -isysroot/-syslibroot, and restrict -xgopherbot commentedon Nov 10, 2026
Change https://go.dev/cl/861523 mentions this issue:
[release-branch.go1.26] cmd/go: disallow --sysroot and -target, validate -isysroot/-syslibroot, and restrict -x[release-branch.go1.27] cmd/go: disallow --sysroot and -target, valid…
[release-branch.go1.26] cmd/go: disallow --sysroot and -target, valid…
[-]security: fix CVE-2026-97033[/-][+]cmd/go: unexpected code execution via --sysroot, -target, -isysroot, -Wl,-syslibroot, and -x cgo flags[/+]gopherbot commentedon Nov 10, 2026
Change https://go.dev/cl/862146 mentions this issue:
cmd/go: disallow --sysroot and -target, validate -isysroot/-syslibroot, and restrict -xcmd/go: disallow --sysroot and -target, validate -isysroot/-syslibroo…