SEVERITY NOT PROVIDED EPSS 0.7% · 48th percentile

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

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 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
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.

References

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