Skip to content
Threat Feed
high advisory

Golang Go: Arbitrary code execution during cgo linking (CVE-2026-97037)

The Go toolchain (cmd/go) is vulnerable to arbitrary code execution during the package build process when processing malicious cgo LDFLAGS, affecting versions prior to 1.26.11 and 1.27.4.

CVE search metadata

CVE search record: CVE-2026-97037. Severity: high. CVSS: 8.8. EPSS: 0.25%. KEV: no. Product: cmd/go. Brief: Golang Go: Arbitrary code execution during cgo linking (CVE-2026-97037). Brief link: https://feed.craftedsignal.io/briefs/2026-11-golang-go-cgo-linker-vulnerability-cve-2026-97037/

Triage facts

Revision 1
Applicability
cmd/go
Evidence
Unknown
Severity
High
Sources
2 public sources
Freshness
Revision 1Nov 16, 16:36 UTC
Vulnerabilities
1 CVE
Source quality
A2Roughly even chance

Overview

CVE-2026-97037 is an arbitrary code execution vulnerability in the Go toolchain (cmd/go) that occurs at link time. Malicious packages utilizing cgo can pass linker script files to the host linker via "#cgo LDFLAGS".

Attack Chain

  • During the build process, the go command processes "#cgo LDFLAGS".
  • Vulnerable versions of the go command previously accepted bare second arguments for split "-Wl," flags without a "-Wl," prefix. This allowed the compiler driver to pass these arguments directly to the linker as positional input files.
  • When using GNU ld.bfd, specific flags (such as "-framework", "-Wl,-framework", "-Wl,-undefined", "-Wl,--just-symbols", "-Wl,-R", "-Wl,-subsystem", and on non-Darwin platforms "-Wl,-sectcreate") could cause the linker to interpret their arguments as linker scripts if the arguments pointed to existing files on disk.

Impact

Successful exploitation allows for arbitrary code execution during the package build process.

Recommendation

The go command has been updated to mitigate this vulnerability by requiring a "-Wl," prefix on the second token of split "-Wl," flags (except "-Wl,-R"), verifying that flags do not reference linker script files, and disallowing bare "-Wl,--warn-backrefs-exclude". Users should upgrade to version 1.26.11 or 1.27.4 or later to address these issues.