# CVE-2026-97037: Go arbitrary code execution via malicious cgo linker flags

Source: https://junglewise.ai/threats/cve-2026-97037-building-a-malicious-package-that-uses-cgo-could-cause-arbitrary  
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-97037 · Severity: info · Published 2026-11-11

Go's build system can be exploited through maliciously crafted packages that use cgo to inject linker script files during compilation. An attacker distributing a malicious package could execute arbitrary code on a developer's machine during the build process, potentially compromising the developer's system and any software they build.

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

## Quick answers

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

**How severe is CVE-2026-97037?** 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-97037?** Yes. toolchain (Go): upgrade to 1.27.4 or later. Until then: The go command now requires a "-Wl," prefix on the second token of split "-Wl," flags (except "-Wl,-R"), verifies that these flags do not reference linker script files, and disallows bare "-Wl,--warn-backrefs-exclude". Upgrade to a patched version of Go that includes these validation checks. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-97037 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-97037?** Check whether you run go (Go) or toolchain (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
  ```


The go command now requires a "-Wl," prefix on the second token of split "-Wl," flags (except "-Wl,-R"), verifies that these flags do not reference linker script files, and disallows bare "-Wl,--warn-backrefs-exclude". Upgrade to a patched version of Go that includes these validation checks.

## Technical details

The vulnerability exists in Go's cgo support where split "-Wl," linker flags (such as "-Wl,-rpath", "-Wl,--just-symbols", "-Wl,-undefined") previously accepted a bare second argument without "-Wl," prefix, which the linker would interpret as a positional input file. Additionally, various flags like "-framework" and "-Wl,-R" could cause GNU ld.bfd to misinterpret their arguments as linker script files. An attacker can craft a malicious package with specially constructed "#cgo LDFLAGS" to pass linker script files to the host linker, achieving arbitrary code execution at link time.

## Affected products

- Go Go

## Identifiers

- CVE-2026-97037
- GO-2026-6854

## Timeline

- 2026-11-11: disclosed

## References

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

## Related threats

- [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)
- [Go command unsafe pkg-config flag handling in cgo](https://junglewise.ai/threats/cve-2026-97039-building-a-malicious-package-that-uses-cgo-pkg-config-directives)
