# CVE-2026-97043: Unexpected code execution via escaped quotes in //go:cgo_ldflag in cmd/go and cmd/compile

- Severity: High 8.8 (CVSS:3.1, scored by CISA-ADP) `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.72%, higher than 55% of CVEs (2026-12-02)
- Published: 2026-11-11T02:51:11.000Z
- Modified: 2026-11-27T06:56:01.611Z
- Also known as: GO-2026-6848, BIT-GOLANG-2026-97043
- Related: RHSA-2026:102586, RHSA-2026:102587, RHSA-2026:102592, RHSA-2026:99003, RHSA-2026:99004
- Weaknesses: CWE-88
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact total
- Assigned by: Go

## 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.

(As written by CVE List.)

## Affected

- cmd/go: before 1.26.11; from 1.27.0-0 before 1.27.4
- cmd/compile: before 1.26.11; from 1.27.0-0 before 1.27.4
- toolchain (Go): before 1.26.11; from 1.27.0-0 before 1.27.4

## References

- <https://go.dev/cl/862156> (fix)
- <https://go.dev/issue/82567> (report)
- <https://groups.google.com/g/golang-announce/c/iY8TY0wWgbM> (web)
- <https://pkg.go.dev/vuln/GO-2026-6848>

## Sources

- CVE List: [CVE-2026-97043](https://www.cve.org/CVERecord?id=CVE-2026-97043), CVE Terms of Use, modified 2026-11-17
- Go Vulnerability Database: [GO-2026-6848](https://pkg.go.dev/vuln/GO-2026-6848), CC-BY-4.0, modified 2026-11-27
- NVD: [CVE-2026-97043](https://nvd.nist.gov/vuln/detail/CVE-2026-97043), Public domain, modified 2026-11-17

---

Page: https://cve.day/CVE-2026-97043 · Whole record: https://cve.day/CVE-2026-97043.json · Rebuilt by cve.day 2026-11-27T07:27:26.465Z
