CVE-2026-97041: Go compiler cgo linker flag injection via directives

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

The Go compiler improperly validated special compiler directives used for C interoperability, allowing a malicious package to inject arbitrary flags into the system linker. An attacker distributing a crafted Go package could gain control over linker behavior, potentially compromising the integrity of compiled binaries on ELF platforms (Linux, BSD).

Technologies: toolchain (Go). Vendors: Go.

Quick answers

Is CVE-2026-97041 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-97041 being exploited in the wild.
How severe is CVE-2026-97041?
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-97041?
Yes. toolchain (Go): upgrade to 1.27.4 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-97041 attacked?
It is attacked with local access, in a software library.
Am I affected by CVE-2026-97041?
Check whether you run Go compiler and linker (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
    go get toolchain@v1.27.4

Technical details

The Go compiler and linker failed to reject commas and "@" prefixes in cgo directives ("//go:cgo_import_dynamic", "//go:cgo_export_dynamic", "//go:cgo_export_static", "//go:cgo_import_static", "//go:cgo_dynamic_linker"), which are passed to the external linker. When combined with how the linker constructs flags like "-Wl,--dynamic-linker,<path>", a comma or leading "@" in these directives could split the argument into multiple linker flags or response file references, injecting arbitrary compiler and linker options. Additionally, the two-argument form of "cgo_import_dynamic" could overwrite symbols previously marked for cgo export, further subverting intended symbol handling.

Affected products

  • Go Go compiler and linker

Identifiers

  • CVE-2026-97041
  • GO-2026-6850

Timeline

  • 2026-11-11: disclosed

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.