SEVERITY NOT PROVIDED EPSS 0.8% · 55th percentile

CVE-2026-97034: Arbitrary command execution via GCC spec files in cgo linker search directories in cmd/go

Published 2026-11-11 · Updated 2026-11-27 · Also known as BIT-golang-2026-97034, GO-2026-6857

Summary

The Go toolchain is vulnerable to arbitrary command execution during the build process when using cgo with specific GCC flags. Developers using Go versions prior to the fixed releases should upgrade their toolchain immediately to mitigate the risk of malicious package exploitation.

Who is affected

This vulnerability affects Go environments where cgo is utilized to link code via GCC, specifically when using flags like -fopenmp, -fopenacc, or -fsanitize=. An attacker can leverage untrusted GCC spec files within build directories or search paths to execute arbitrary commands on the host machine at link time. The vulnerability exists because the compiler search mechanism can be tricked into evaluating malicious spec files.

Exploitability

The vulnerability's severity is currently unknown, with no provided CVSS vector or base score. However, an EPSS score of 0.008 indicates a low probability of exploitation. There is no evidence of active exploitation as the vulnerability is not listed in the CISA Known Exploited Vulnerabilities catalog.

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 is the primary risk of this vulnerability?

The primary risk is arbitrary command execution during the compilation and linking process, allowing a malicious package to run code on the developer's or build server's system.

Does this affect all Go programs?

No, it specifically affects projects using cgo that also include specific compiler flags like -fopenmp, -fopenacc, or -fsanitize=.

Is this vulnerability actively being exploited?

Not documented by the CISA KEV catalog; there is no current evidence of active exploitation.

Original advisory description
When using GCC, building a malicious package that uses cgo could cause arbitrary command execution at link time via untrusted GCC spec files ("specs" or "*.spec"). When linking with "-fopenmp", "-fopenacc", or "-fsanitize=" in "#cgo LDFLAGS", GCC's built-in link spec evaluates "%:include(libgomp.spec)" or "%:include(libsanitizer.spec)" and searches for spec files in "-L" and sysroot directories (including subdirectories and multilib sibling directories such as "../lib64"), as well as the working directory when "-fopenmp" or "-fopenacc" is used or when "-fsanitize=" is combined with "-static" or "-static-lib*". The go command now rejects "-L", "-isysroot", and "-Wl,-syslibroot" directories (and the working and package directories when applicable) that contain GCC spec files, and disallows "@" and "-" prefixes in "-fsanitize=" compiler flag values.

References

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