{"id":"GO-2026-6849","revision":"1b2d7a7779d34b5e80bfcee46f86a3ea","records":[{"revision":"1b2d7a7779d34b5e80bfcee46f86a3ea","observedAt":"2026-11-11T04:27:36.086+00:00","statement":{"source":"osv","id":"GO-2026-6849","aliases":["CVE-2026-97042"],"title":"Linker flag injection via cgo_import_dynamic and PE DLL names in cmd/cgo, cmd/compile, and cmd/link","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.\n\nThe 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.\n\nThe 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 \"@\".","state":0,"publishedAt":"2026-11-11T02:51:11+00:00","modifiedAt":"2026-11-11T03:15:14.799111+00:00","affected":[{"ecosystem":"Go","name":"toolchain","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0"},{"kind":"fixed","version":"1.26.11"},{"kind":"introduced","version":"1.27.0-0"},{"kind":"fixed","version":"1.27.4"}]}],"versions":[],"rawVersionEvidence":null}],"metrics":[],"references":["https://go.dev/cl/862155","https://go.dev/issue/82568","https://groups.google.com/g/golang-announce/c/iY8TY0wWgbM"],"sourceUrl":"https://osv.dev/vulnerability/GO-2026-6849","license":"OSV · upstream source license applies","key":"osv:GO-2026-6849","identifiers":["GO-2026-6849","CVE-2026-97042"]},"retained":false,"historicalAffected":[]}],"coverage":[]}