CVE-2026-97039: Flag sanitization bypass via "#cgo pkg-config:" directives in cmd/go
Published 2026-11-11 · Updated 2026-11-27 · Also known as BIT-golang-2026-97039, GO-2026-6852
Summary
A flag sanitization bypass in the Go toolchain's #cgo pkg-config directives allows malicious packages to load untrusted .pc files or inject unvalidated compiler and linker flags. Engineering and security teams managing Go development environments must update the Go toolchain.
Who is affected
Deployments building untrusted Go packages or modules are affected by this vulnerability. By utilizing crafted #cgo pkg-config directives, an attacker can bypass previous flag allowlists using parameters like --with-path=, --personality=, or modified --define-variable= values, alongside local .pc path traversal.
Exploitability
The severity and CVSS vector are not documented, and the CISA Known Exploited Vulnerabilities list indicates no active exploitation. The EPSS score is 0.005 with a percentile of 0.347, indicating a low observed probability of exploitation.
Remediation
- Update the Go toolchain to fixed version 1.26.11 or 1.27.4.
How to check your project
- Check the installed Go toolchain version by running 'go version' to determine if it falls within the affected ranges (introduced before 1.26.11 or between 1.27.0-0 and 1.27.4).
Automated analysis of the published advisory data, generated 2026-11-27. Not human-reviewed; verify against the official advisory. How this works.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | Upgrade |
|---|---|---|---|---|
| Go | toolchain |
>= 0, < 1.26.11 | 1.26.11 | go get [email protected] |
| Go | toolchain |
>= 1.27.0-0, < 1.27.4 | 1.27.4 | go get [email protected] |
FAQ
What causes the vulnerability?
The vulnerability is caused by insufficient filtering and allowlisting in cmd/go for #cgo pkg-config directives, which previously permitted dangerous flags, unvalidated variable values, and direct loading of local .pc files.
Which versions are affected?
Go toolchain versions introduced prior to 1.26.11 and versions from 1.27.0-0 up to, but not including, 1.27.4 are affected.
How can I fix the issue?
You can fix the issue by updating your Go toolchain to version 1.26.11 or version 1.27.4.
Original advisory description
References
- FIX https://go.dev/cl/862152
- REPORT https://go.dev/issue/82571
- WEB https://groups.google.com/g/golang-announce/c/iY8TY0wWgbM
Source records: GO-2026-6852 (OSV.dev) · EPSS by FIRST, 2026-11-27.