GO-2026-6849

Source
https://pkg.go.dev/vuln/GO-2026-6849
Import Source
https://vuln.go.dev/ID/GO-2026-6849.json
JSON Data
https://api.osv.dev/v1/vulns/GO-2026-6849
Aliases
  • CVE-2026-97042
Published
2026-11-11T02:51:11Z
Modified
2026-11-11T03:15:14Z
Summary
Linker flag injection via cgo_import_dynamic and PE DLL names in cmd/cgo, cmd/compile, and cmd/link
Details

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" 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 "@".

Database specific
{
    "review_status": "REVIEWED",
    "url": "https://pkg.go.dev/vuln/GO-2026-6849"
}
References

Affected packages

Go / toolchain

Package

Name
toolchain
View open source insights on deps.dev
Purl
pkg:golang/toolchain

Affected ranges

Type
SEMVER
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
1.26.11
Introduced
1.27.0-0
Fixed
1.27.4

Ecosystem specific

{
    "imports": [
        {
            "path": "cmd/cgo"
        },
        {
            "path": "cmd/compile"
        },
        {
            "path": "cmd/link"
        }
    ]
}

Database specific

source
"https://vuln.go.dev/ID/GO-2026-6849.json"