---
id: "CVE-2026-97034"
page: "https://infrastack.ai/live/CVE-2026-97034"
kind: "vulnerability"
aliases: ["CVE-2026-97034", "GO-2026-6857"]
title: "Arbitrary command execution via GCC spec files in cgo linker search directories in cmd/go"
severity: "high"
cvss: null
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "toolchain", "fixed": ["1.26.11", "1.27.4"], "affected": ">= 1.27.0-0, < 1.27.4", "ecosystem": "go"}]
ecosystems: ["go"]
tags: ["build-servers", "cgo", "ci", "gcc", "go", "package"]
not_affected_if: ["cgo-disabled", "clang-toolchain", "no-untrusted-cgo-packages"]
published_at: "2026-11-11T02:51:11+00:00"
first_seen_at: "2026-11-11T03:37:17+00:00"
updated_at: "2026-11-11T03:39:00+00:00"
sources: [{"source": "govuln", "url": "https://pkg.go.dev/vuln/GO-2026-6857", "first_seen_at": "2026-11-11T03:37:17+00:00"}]
exploit_sources: []
---

# Arbitrary command execution via GCC spec files in cgo linker search directories in cmd/go

Link for people: https://infrastack.ai/live/CVE-2026-97034 (this .md is for agents)

A malicious Go package that uses cgo can make GCC load an untrusted spec file during linking, which runs attacker-chosen commands on the build machine. The risk is at build time, when a team compiles code that pulls in a hostile cgo package.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- go:toolchain affected >= 1.27.0-0, < 1.27.4 fixed 1.26.11, 1.27.4

## How to check

- Run `go version` and compare against the fixed releases.
- Check whether builds use cgo (`CGO_ENABLED=1`) with GCC and link flags containing `-fopenmp`, `-fopenacc` or `-fsanitize=`.
- Review third-party cgo dependencies in `go.mod`.

## Fix

- Go `1.26.11`
- Go `1.27.4`

## Timeline

- 2026-11-11T03:37:17+00:00 govuln https://pkg.go.dev/vuln/GO-2026-6857

## From the sources

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.

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
