Go toolchainの脆弱性、悪意あるパッケージでビルド時にコードを実行される恐れ
Summary
Go toolchainのcmd/goとcmd/compileに脆弱性があり、cgoを使う悪意あるパッケージをビルドすると、ビルド時に意図しないコードが実行されるおそれがあります。影響を受けるのは1.26.11より前の1.26系と、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とcmd/compileに脆弱性があり、cgoを使う悪意あるパッケージをビルドすると、ビルド時に意図しないコードが実行されるおそれがあります。影響を受けるのは1.26.11より前の1.26系と、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 |
| Go toolchaincmd/compile |
< 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-97043 go Fix available
- BellSoft Alpaquita BELL-CVE-2026-97043 go Fix available
- Debian DEBIAN-CVE-2026-97043 golang-1.27, golang-1.26 Fix available
- Ubuntu UBUNTU-CVE-2026-97043 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 could bypass "#cgo LDFLAGS" validation and cause unexpected code execution at build time, or cause the go command to panic, via crafted quoting in "//go:cgo_ldflag" directives.
When "cmd/cgo" generates "_cgo_gotypes.go", it quotes each "#cgo LDFLAGS" argument with strconv.Quote in a "//go:cgo_ldflag" directive, but "cmd/compile" and "cmd/go" parsed those directives by splitting on raw quote characters without handling backslash escapes or unquoting the string. This mismatch allowed disallowed linker flags or unvalidated linker search paths to be smuggled past the go command's flag checks and passed to the external linker. In addition, deduplicating LDFLAGS in the go command could panic with an out-of-bounds slice index when a prefix of the flag list matched near the end of the slice.
"cmd/compile" and "cmd/go" now properly handle backslash-escaped quotes and unquote "//go:cgo_*" pragma strings with strconv.Unquote, and the slice bounds check in processCgoOutputs has been fixed.
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