SEVERITY NOT PROVIDED EPSS 0.5% · 35th percentile

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

How to check your project

Automated analysis of the published advisory data, generated 2026-11-27. Not human-reviewed; verify against the official advisory. How this works.

Affected packages

EcosystemPackageAffected versionsFixed inUpgrade
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
Building a malicious package that uses "#cgo pkg-config:" directives could load untrusted pkg-config ".pc" files or inject unvalidated compiler and linker flags. The pkg-config flag allowlist previously permitted "--with-path=" and "--personality=", allowed "--define-variable=" values beginning with "=" or "$" (which can rewrite paths in system ".pc" files into sysroot-prefixed "-L=" or "-L$SYSROOT" linker search paths), and allowed package arguments ending in ".pc" or containing path separators or "..", which caused pkg-config to load local ".pc" files directly from the package directory. In addition, flags returned by "pkg-config --cflags" in cgoCPPFLAGS were not checked when determining whether internal linking is safe. The go command now disallows "--with-path=", "--personality=", leading "=" or "$" characters in "--define-variable=" values, and local ".pc" paths in "#cgo pkg-config:" directives, and inspects cgoCPPFLAGS when checking internal linking compatibility.

References

Source records: GO-2026-6852 (OSV.dev) · EPSS by FIRST, 2026-11-27.