# CVE-2026-97042: Linker flag injection via cgo_import_dynamic and PE DLL names in cmd/cgo, cmd/compile, and cmd/link

- 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.57%, higher than 48% of CVEs (2026-12-02)
- Published: 2026-11-11T02:51:11.000Z
- Modified: 2026-11-25T10:42:40.349Z
- Also known as: GO-2026-6849
- Related: RHSA-2026:101231, 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 "//go:cgo_import_dynamic" or links against a crafted PE object on Windows could pass unsafe library arguments to the external linker. The compiler only checked the first character of the library name in "//go:cgo_import_dynamic" directives and skipped validation in cgo-generated files. In addition, on Windows, "cmd/cgo" and "cmd/link" did not validate imported DLL names extracted from PE object files before emitting "-l<name>" flags for the external linker, allowing a crafted DLL name containing ".." path traversal or special characters to reference arbitrary files on disk. The compiler now validates every character of the library name in "//go:cgo_import_dynamic" directives (including in cgo-generated files on Windows) and rejects ".." path traversal, and "cmd/cgo" and "cmd/link" reject PE imported DLL names containing path separators, "..", ":", or leading "-" or "@".

(As written by CVE List.)

## Affected

- cmd/cgo: 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
- cmd/link: 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/862155> (fix)
- <https://go.dev/issue/82568> (report)
- <https://groups.google.com/g/golang-announce/c/iY8TY0wWgbM> (web)
- <https://pkg.go.dev/vuln/GO-2026-6849>

## Sources

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

---

Page: https://cve.day/CVE-2026-97042 · Whole record: https://cve.day/CVE-2026-97042.json · Rebuilt by cve.day 2026-11-25T22:59:50.323Z
