# CVE-2026-97034: Go compiler arbitrary command execution via untrusted GCC spec files

Source: https://junglewise.ai/threats/cve-2026-97034-when-using-gcc-building-a-malicious-package-that-uses-cgo-could  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-11-11. Updated: 2026-11-11  
License: CC BY 4.0 with a link back

CVE-2026-97034 · Severity: info · Published 2026-11-11

Go's compiler can execute arbitrary commands at build time when compiling packages that use cgo with certain GCC linking flags, if an attacker can place malicious GCC spec files in directories searched during the build process. An attacker who controls build artifacts or dependencies could achieve code execution on developer machines or build systems during the compilation of a Go package.

Technologies: [toolchain (Go)](https://junglewise.ai/threats/technologies/toolchain), [Google Go](https://junglewise.ai/threats/technologies/google-go). Vendors: [Go](https://junglewise.ai/threats/vendors/go), [Google](https://junglewise.ai/threats/vendors/google).

## Quick answers

**Is CVE-2026-97034 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-97034 being exploited in the wild.

**How severe is CVE-2026-97034?** Informational severity, published 11 November 2026.

**Which products and versions are affected?** toolchain (Go) SEMVER:introduced=0,fixed=1.26.11,introduced=1.27.0-0,fixed=1.27.4.

**Is there a fix for CVE-2026-97034?** Yes. toolchain (Go): upgrade to 1.27.4 or later. Until then: Do not build untrusted Go packages or place untrusted code in build directories where GCC spec files could be injected. Ensure build systems isolate dependency compilation in restricted directories. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-97034 attacked?** It is attacked with local access, in a software library.

**Am I affected by CVE-2026-97034?** Check whether you run toolchain (Go) or Google Go at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- toolchain (Go): upgrade to 1.27.4 or later

  ```sh
  go get toolchain@v1.27.4
  ```


Do not build untrusted Go packages or place untrusted code in build directories where GCC spec files could be injected. Ensure build systems isolate dependency compilation in restricted directories.

## Technical details

When Go uses GCC to link code with "-fopenmp", "-fopenacc", or "-fsanitize=" flags via cgo, GCC searches for and evaluates spec files from "-L" directories, sysroot directories, and the working directory. An attacker can place malicious spec files in these locations to inject arbitrary link commands. The Go compiler now rejects such directories containing spec files and restricts "-fsanitize=" flag syntax to prevent this attack.

## Affected products

- Google Go

## Identifiers

- CVE-2026-97034
- GO-2026-6857

## Timeline

- 2026-11-11: disclosed

## References

- [https://pkg.go.dev/](https://pkg.go.dev/)
- [https://go.dev/cl/862147](https://go.dev/cl/862147)

## Related threats

- [Go HTTP/1 server race condition in MaxBytesReader header handling](https://junglewise.ai/threats/cve-2026-97054-for-http-1-servers-when-maxbytesreader-s-limit-is-exceeded)
- [Go cgo LDFLAGS validation bypass in cmd/cgo](https://junglewise.ai/threats/cve-2026-97043-building-a-malicious-package-that-uses-cgo-could-bypass-cgo)
- [Go compiler unsafe library path validation in Windows linker](https://junglewise.ai/threats/cve-2026-97042-building-a-malicious-package-that-uses-go-cgo-import-dynamic-or)
- [Go compiler cgo linker flag injection via directives](https://junglewise.ai/threats/cve-2026-97041-building-a-malicious-package-containing-go-cgo-compiler)
- [Go linker arbitrary flag injection via crafted .syso files](https://junglewise.ai/threats/cve-2026-97040-building-a-package-containing-a-crafted-syso-file-could-bypass)
