Go toolchainのcmd/goに脆弱性、悪意あるパッケージのビルドで信頼されないpkg-config設定が読み込まれるおそれ
Summary
Go toolchainのcmd/goには、悪意あるパッケージを「#cgo pkg-config:」を使ってビルドすると、信頼されないpkg-configの.pcファイルが読み込まれたり、検証されていないコンパイラ・リンカーのフラグが注入されたりする脆弱性があります。影響を受けるのは1.26.11より前、および1.27.0以降1.27.4より前のバージョンです。修正版の1.26.11または1.27.4への更新をおすすめします。
AI summary
Produced by SecPulse using an external AI model; it may contain mistakes. Check the original description and references below before acting on it.
Go toolchainのcmd/goには、悪意あるパッケージを「#cgo pkg-config:」を使ってビルドすると、信頼されないpkg-configの.pcファイルが読み込まれたり、検証されていないコンパイラ・リンカーのフラグが注入されたりする脆弱性があります。影響を受けるのは1.26.11より前、および1.27.0以降1.27.4より前のバージョンです。修正版の1.26.11または1.27.4への更新をおすすめします。
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| Go toolchaincmd/go |
< 1.26.11→ 1.26.11 ≥ 1.27.0-0, < 1.27.4→ 1.27.4 |
1.26.11 1.27.4 |
| Gotoolchain |
< 1.26.11→ 1.26.11 ≥ 1.27.0-0, < 1.27.4→ 1.27.4 |
1.26.11 1.27.4 |
Fix status by distribution
Records published by each distribution for this CVE. Fixed versions differ by release; check each link.
- Alpine Linux ALPINE-CVE-2026-97039 go Fix available
- BellSoft Alpaquita BELL-CVE-2026-97039 go Fix available
- Debian DEBIAN-CVE-2026-97039 golang-1.27, golang-1.26 Fix available
- Ubuntu UBUNTU-CVE-2026-97039 golang-1.27, golang-1.26, golang-1.25 +14 more No fixed version in this record
Original description The description as published by the source.
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.
Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory
References
- patch go.dev
- report go.dev
- web groups.google.com
- web security@golang.org
- web nvd.nist.gov
- web github.com