SEVERITY NOT PROVIDED EPSS 0.6% · 48th percentile

CVE-2026-97041: Host linker flag injection via //go:cgo_* directives in cmd/compile and cmd/link

Published 2026-11-11 · Updated 2026-11-25 · Also known as GO-2026-6850

Summary

A host linker flag injection vulnerability in cmd/compile and cmd/link allows malicious Go packages containing crafted //go:cgo_* directives to inject arbitrary flags into external linker invocations on ELF platforms. Security and engineering teams using the affected Go toolchain should update to patched versions.

Who is affected

This flaw impacts environments building Go code on ELF platforms using Go toolchain versions prior to 1.26.11 or versions 1.27.0-0 through 1.27.3. Exploitation requires building a malicious package containing //go:cgo_* compiler directives with commas, leading '@' characters, or symbol overwrites. Successful exploitation allows splitting host linker flag arguments or response file arguments during external linker invocation.

Exploitability

CVSS metrics and vector details are not documented for this issue. The vulnerability has an EPSS score of 0.006 (0.481st percentile), and CISA KEV confirms there is no active exploitation.

Remediation

How to check your project

Automated analysis of the published advisory data, generated 2026-11-25. Not human-reviewed; verify against the official advisory. How this works.

Affected packages

EcosystemPackageAffected versionsFixed inUpgrade
Go toolchain >= 0, < 1.26.11 1.26.11 go get [email protected]
Go toolchain >= 1.27.0-0, < 1.27.4 1.27.4 go get [email protected]

FAQ

What causes the linker flag injection?

The compiler and linker failed to reject commas and leading '@' characters in //go:cgo_* directives and allowed //go:cgo_import_dynamic to overwrite export symbol names, enabling arbitrary argument splitting into external linker invocations.

Is this vulnerability actively exploited in the wild?

No, CISA KEV reports active exploitation as 'no', and it has an EPSS score of 0.006.

Are any workarounds documented for this vulnerability?

Workarounds are not documented; upgrading to fixed Go toolchain versions (1.26.11 or 1.27.4) is required.

Original advisory description
Building a malicious package containing "//go:cgo_*" compiler directives could inject arbitrary flags into the external linker invocation on ELF platforms. The compiler and linker did not reject commas in "//go:cgo_import_dynamic", "//go:cgo_export_dynamic", "//go:cgo_export_static", "//go:cgo_import_static", and "//go:cgo_dynamic_linker" directives, and the linker passed the dynamic linker path using "-Wl,--dynamic-linker,<path>". Furthermore, the two-argument form of "//go:cgo_import_dynamic" (which is permitted in non-cgo Go source files) could overwrite the external symbol name of a symbol already marked for cgo export. A symbol name or dynamic linker path containing a comma or leading "@" could split "-Wl,--export-dynamic-symbol=" or "-Wl,--dynamic-linker," into arbitrary host linker flags or response file arguments. The compiler and linker now reject commas in "//go:cgo_*" symbol and dynamic linker directives, the linker passes "-Wl,--dynamic-linker=<path>", and "cgo_import_dynamic" no longer overwrites symbols exported via "cgo_export_dynamic" or "cgo_export_static".

References

Source records: GO-2026-6850 (OSV.dev) · EPSS by FIRST, 2026-11-25.