Text of github.com › golang › go › issues › 82568 as Styx crawled it on Nov 20, 2026. The page may have changed since. Only its words are kept, without pictures or layout.

Open the live page

cmd/cgo, cmd/compile, cmd/link: linker flag injection via cgo_import_dynamic and PE DLL names · Issue #82568 · golang/go · GitHub

Skip to content You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert cmd/cgo, cmd/compile, cmd/link: linker flag injection via cgo_import_dynamic and PE DLL names #82568 New issue Copy link New issue Copy link Closed Closed cmd/cgo, cmd/compile, cmd/link: linker flag injection via cgo_import_dynamic and PE DLL names #82568 Copy link Labels Security compiler/runtime Issues related to the Go compiler and/or runtime.

Issues related to the Go compiler and/or runtime. release-blocker Milestone Go1.28 Description nicholashusin opened on Oct 26, 2026 Issue body actions 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 "@".

This issue was found by the Go Security Team during an internal audit. This is CVE-2026-97042 and Go issue https://go.dev/issue/82568 . This was a PRIVATE track issue originally tracked in http://b/568055805 . Activity nicholashusin added Security release-blocker on Oct 26, 2026 nicholashusin added this to the Go1.28 milestone on Oct 26, 2026 nicholashusin commented on Oct 26, 2026 nicholashusin on Oct 26, 2026 Member Author More actions Hi @gopherbot , please open backport issues for this security issue. gopherbot commented on Oct 26, 2026 gopherbot on Oct 26, 2026 Contributor More actions Backport issue(s) opened: #82581 (for 1.26), #82582 (for 1.27).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases . gopherbot commented on Nov 10, 2026 gopherbot on Nov 10, 2026 Contributor More actions Change https://go.dev/cl/861532 mentions this issue: [release-branch.go1.26] cmd/cgo, cmd/compile, cmd/link: validate cgo_import_dynamic library names gopherbot commented on Nov 10, 2026 gopherbot on Nov 10, 2026 Contributor More actions Change https://go.dev/cl/861493 mentions this issue: [release-branch.go1.27] cmd/cgo, cmd/compile, cmd/link: validate cgo_import_dynamic library names gopherbot added 2 commits that reference this issue on Nov 10, 2026 [release-branch.go1.27] cmd/cgo, cmd/compile, cmd/link: validate cgo_… e6ea940 [release-branch.go1.26] cmd/cgo, cmd/compile, cmd/link: validate cgo_… 29cb161 thatnealpatel changed the title [-] security: fix CVE-2026-97042 [/-] [+] cmd/cgo, cmd/compile, cmd/link: linker flag injection via cgo_import_dynamic and PE DLL names [/+] on Nov 10, 2026 gopherbot added compiler/runtime Issues related to the Go compiler and/or runtime.

Issues related to the Go compiler and/or runtime. on Nov 10, 2026 github-project-automation added this to Go Compiler / Runtime / Command on Nov 10, 2026 gopherbot commented on Nov 10, 2026 gopherbot on Nov 10, 2026 Contributor More actions Change https://go.dev/cl/862155 mentions this issue: cmd/cgo, cmd/compile, cmd/link: validate cgo_import_dynamic library names gopherbot added a commit that references this issue on Nov 10, 2026 cmd/cgo, cmd/compile, cmd/link: validate cgo_import_dynamic library n… 5e49f9f thatnealpatel closed this as completed on Nov 11, 2026 github-project-automation moved this to Done in Go Compiler / Runtime / Command on Nov 11, 2026 Sign up for free to join this conversation on GitHub.

Already have an account? Sign in to comment Metadata Metadata Assignees No one assigned Labels Security compiler/runtime Issues related to the Go compiler and/or runtime. Issues related to the Go compiler and/or runtime. release-blocker Type No type Projects Go Compiler / Runtime / Command Status Done Show more project fields Milestone Go1.28 No due date Relationships None yet Development No branches or pull requests Issue actions You can’t perform that action at this time.