# CVE-2026-97042: Go compiler unsafe library path validation in Windows linker

Source: https://junglewise.ai/threats/cve-2026-97042-building-a-malicious-package-that-uses-go-cgo-import-dynamic-or  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-11-11. Updated: 2026-11-11  
License: CC BY 4.0 with a link back

CVE-2026-97042 · Severity: info · Published 2026-11-11

The Go compiler did not properly validate library names in certain directives and when linking against Windows DLL files, allowing an attacker to build a malicious package that could cause the compiler to reference arbitrary files on disk. An attacker could exploit this by distributing a malicious Go package that, when compiled, instructs the external linker to access sensitive files or execute unintended code. This affects developers who build Go programs on Windows or use untrusted third-party Go packages.

Technologies: [toolchain (Go)](https://junglewise.ai/threats/technologies/toolchain), [Google Go](https://junglewise.ai/threats/technologies/google-go). Vendors: [Go](https://junglewise.ai/threats/vendors/go), [Google](https://junglewise.ai/threats/vendors/google).

## Quick answers

**Is CVE-2026-97042 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-97042 being exploited in the wild.

**How severe is CVE-2026-97042?** Informational severity, published 11 November 2026.

**Which products and versions are affected?** toolchain (Go) SEMVER:introduced=0,fixed=1.26.11,introduced=1.27.0-0,fixed=1.27.4; Google Go Prior to fix version.

**Is there a fix for CVE-2026-97042?** Yes. toolchain (Go): upgrade to 1.27.4 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-97042 attacked?** It is attacked with local access, in a software library.

**Am I affected by CVE-2026-97042?** Check whether you run toolchain (Go) or Google Go at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- toolchain (Go): upgrade to 1.27.4 or later

  ```sh
  go get toolchain@v1.27.4
  ```


## Technical details

The vulnerability exists in Go's compiler (cmd/cgo and cmd/link) which failed to validate library names in "//go:cgo_import_dynamic" directives and DLL names extracted from PE object files on Windows. An attacker can craft a malicious Go package or PE object with library names containing ".." path traversal sequences, special characters, or path separators to cause the linker to reference arbitrary files. The fix validates every character of library names, rejecting ".." traversal, path separators, colons, and leading "-" or "@" characters.

## Affected products

- Google Go Prior to fix version

## Identifiers

- CVE-2026-97042
- GO-2026-6849

## Timeline

- 2026-11-11: disclosed

## References

- [https://pkg.go.dev/](https://pkg.go.dev/)
- [https://go.dev/cl/862155](https://go.dev/cl/862155)

## Related threats

- [Go HTTP/1 server race condition in MaxBytesReader header handling](https://junglewise.ai/threats/cve-2026-97054-for-http-1-servers-when-maxbytesreader-s-limit-is-exceeded)
- [Go cgo LDFLAGS validation bypass in cmd/cgo](https://junglewise.ai/threats/cve-2026-97043-building-a-malicious-package-that-uses-cgo-could-bypass-cgo)
- [Go compiler cgo linker flag injection via directives](https://junglewise.ai/threats/cve-2026-97041-building-a-malicious-package-containing-go-cgo-compiler)
- [Go linker arbitrary flag injection via crafted .syso files](https://junglewise.ai/threats/cve-2026-97040-building-a-package-containing-a-crafted-syso-file-could-bypass)
- [Go command unsafe pkg-config flag handling in cgo](https://junglewise.ai/threats/cve-2026-97039-building-a-malicious-package-that-uses-cgo-pkg-config-directives)
