{"id":"GO-2026-6858","revision":"75489370b01d43c0bf4239bbafc82f45","records":[{"revision":"75489370b01d43c0bf4239bbafc82f45","observedAt":"2026-11-11T04:27:36.086+00:00","statement":{"source":"osv","id":"GO-2026-6858","aliases":["CVE-2026-97033"],"title":"Unexpected code execution via --sysroot, -target, -isysroot, -Wl,-syslibroot, and -x cgo flags in cmd/go","description":"Building a malicious package that uses cgo could cause arbitrary code execution at build time through several compiler and linker flags permitted in \"#cgo\" directives.\n\nSpecifically, \"--sysroot\" in GCC and Clang relocates compiler subprograms, spec files, and CRT startup objects to an attacker-controlled directory; \"-target\" in Clang falls back to executing target helper tools from the current working directory when not found in PATH; \"-isysroot\" and \"-Wl,-syslibroot\" can pass a regular file on disk to GNU ld.bfd, which interprets it as a positional linker script; and \"-x\" permitted specifying arbitrary compiler input languages beyond those supported by cgo.\n\n\"--sysroot\" and \"-target\" are now disallowed in \"#cgo\" flags, \"-isysroot\" and \"-Wl,-syslibroot\" are verified not to point to regular files, and \"-x\" is restricted to the C, C++, Objective-C, and assembler languages supported by cgo.","state":0,"publishedAt":"2026-11-11T02:51:11+00:00","modifiedAt":"2026-11-11T03:15:14.803159+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/862146","https://go.dev/issue/82577","https://groups.google.com/g/golang-announce/c/iY8TY0wWgbM"],"sourceUrl":"https://osv.dev/vulnerability/GO-2026-6858","license":"OSV · upstream source license applies","key":"osv:GO-2026-6858","identifiers":["GO-2026-6858","CVE-2026-97033"]},"retained":false,"historicalAffected":[]}],"coverage":[]}