CVE-2026-97043

Unexpected code execution via escaped quotes in //go:cgo_ldflag in cmd/go and cmd/compile

Description

Building a malicious package that uses cgo could bypass "#cgo LDFLAGS" validation and cause unexpected code execution at build time, or cause the go command to panic, via crafted quoting in "//go:cgo_ldflag" directives. When "cmd/cgo" generates "_cgo_gotypes.go", it quotes each "#cgo LDFLAGS" argument with strconv.Quote in a "//go:cgo_ldflag" directive, but "cmd/compile" and "cmd/go" parsed those directives by splitting on raw quote characters without handling backslash escapes or unquoting the string. This mismatch allowed disallowed linker flags or unvalidated linker search paths to be smuggled past the go command's flag checks and passed to the external linker. In addition, deduplicating LDFLAGS in the go command could panic with an out-of-bounds slice index when a prefix of the flag list matched near the end of the slice. "cmd/compile" and "cmd/go" now properly handle backslash-escaped quotes and unquote "//go:cgo_*" pragma strings with strconv.Unquote, and the slice bounds check in processCgoOutputs has been fixed.

Key facts

Published
11 Nov 2026
Last changed
11 Nov 2026
Assigned by
Go
EPSS
0.264% likely to be exploited in the next 30 days, higher than 18.514% of CVEs (scores for 15 Nov 2026)

Historical context and remediation

This reference retains the original CVE publication date. A recent record update does not mean a new attack occurred.

No separately sourced impact summary is available on this page yet. Consult the description, version data and dated exploitation evidence.

No explicit remediation statement is available on this page yet. Consult the original record and vendor references before choosing a fix.

Version statuses below come from the CNA. An “unaffected” version is not necessarily a currently supported release or proof of a patch date. EPSS is a dated risk estimate, not a count of historical attacks.

Read the original CVE record.

Affected products

VendorProductVersions
Go toolchaincmd/go
  • Default status: unaffected
  • 0 up to but excluding 1.26.11 (affected)
  • 1.27.0-0 up to but excluding 1.27.4 (affected)
Go toolchaincmd/compile
  • Default status: unaffected
  • 0 up to but excluding 1.26.11 (affected)
  • 1.27.0-0 up to but excluding 1.27.4 (affected)

Timeline

  1. 11 Nov 2026 Published

References