Go 1.20.5 のリリース【セキュリティ・アップデート】
今回は CVE ID ベースで4件の脆弱性修正を含んでいる。
CVE-2023-29402 cmd/go: cgo code injection
The go command may generate unexpected code at build time when using cgo. This may result in unexpected behavior when running a go program which uses cgo.
This may occur when running an untrusted module which contains directories with newline characters in their names. Modules which are retrieved using the go command, i.e. via “
go get
”, are not affected (modules retrieved using GOPATH-mode, i.e.GO111MODULE=off
, may be affected).
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- 深刻度: 緊急 (Score: 9.8)
基本評価基準 | 評価値 |
---|---|
攻撃元区分 | ネットワーク |
攻撃条件の複雑さ | 低 |
必要な特権レベル | 不要 |
ユーザ関与レベル | 不要 |
スコープ | 変更なし |
機密性への影響 | 高 |
完全性への影響 | 高 |
可用性への影響 | 高 |
CVE-2023-29403 runtime: unexpected behavior of setuid/setgid binaries
The Go runtime didn’t act any differently when a binary had thesetuid/setgid
bit set. On Unix platforms, if asetuid/setgid
binary was executed with standard I/O file descriptors closed, opening any files could result in unexpected content being read/written with elevated prilieges. Similarly if asetuid/setgid
program was terminated, either via panic or signal, it could leak the contents of its registers.
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
- 深刻度: 重要 (Score: 7.8)
基本評価基準 | 評価値 |
---|---|
攻撃元区分 | ローカル |
攻撃条件の複雑さ | 低 |
必要な特権レベル | 不要 |
ユーザ関与レベル | 要 |
スコープ | 変更なし |
機密性への影響 | 高 |
完全性への影響 | 高 |
可用性への影響 | 高 |
CVE-2023-29404, CVE-2023-29405 cmd/go: improper sanitization of LDFLAGS
The go command may execute arbitrary code at build time when using cgo. This may occur when running “go get
” on a malicious module, or when running any other command which builds untrusted code. This is can by triggered by linker flags, specified via a “#cgo LDFLAGS
” directive.
これについては追加情報があって
Due to an unfortunate mistake, this change will break the use of “#cgo LDFLAGS
” directives when using-compiler=gccgo
. Most people using gccgo or GoLLVM use thecmd/go
that is distributed with those tools, and that is unaffected. Therefore, we will fix this in the next minor release. The current minor releases 1.20.5 and 1.19.10 are unfortunately broken for some cases when using gccgo or GoLLVM. Our apologies for the mishap. Thanks to Jeffrey Tolar for spotting the problem.
とのこと。 gccgo や GoLLVM を使っている人は要注意である。
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
(CVE-2023-29404)- 深刻度: 緊急 (Score: 9.8)
基本評価基準 | 評価値 |
---|---|
攻撃元区分 | ネットワーク |
攻撃条件の複雑さ | 低 |
必要な特権レベル | 不要 |
ユーザ関与レベル | 不要 |
スコープ | 変更なし |
機密性への影響 | 高 |
完全性への影響 | 高 |
可用性への影響 | 高 |
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
(CVE-2023-29405)- 深刻度: 緊急 (Score: 9.8)
基本評価基準 | 評価値 |
---|---|
攻撃元区分 | ネットワーク |
攻撃条件の複雑さ | 低 |
必要な特権レベル | 不要 |
ユーザ関与レベル | 不要 |
スコープ | 変更なし |
機密性への影響 | 高 |
完全性への影響 | 高 |
可用性への影響 | 高 |
例によって…
Ubuntu の APT で管理している Go コンパイラは古いので,ダウンロードページからバイナリ(go1.20.5.linux-amd64.tar.gz
)を取ってきてインストールすることを推奨する。
以下は完全手動での作業例。
$ cd /usr/local/src
$ sudo curl -L "https://go.dev/dl/go1.20.5.linux-amd64.tar.gz" -O
$ cd ..
$ sudo unlink go # 以前の Go が入っている場合
$ sudo tar xvf src/go1.20.5.linux-amd64.tar.gz
$ sudo mv go go1.20.5
$ sudo ln -s go1.20.5 go
$ go version # /usr/local/go/bin にパスが通っている場合
go version go1.20.5 linux/amd64
Windows はインストールパッケージを取ってきて直接インストールする。 Scoop 経由でも OK
複数バージョンの Go コンパイラを扱いたい場合は
$ go install golang.org/dl/go1.20.5@latest
$ go1.20.5 download
$ go1.20.5 version
go version go1.20.5 linux/amd64
てな感じで導入できる。
アップデートは計画的に。
参考図書
- プログラミング言語Go (ADDISON-WESLEY PROFESSIONAL COMPUTING SERIES)
- Alan A.A. Donovan (著), Brian W. Kernighan (著), 柴田 芳樹 (翻訳)
- 丸善出版 2016-06-20
- 単行本(ソフトカバー)
- 4621300253 (ASIN), 9784621300251 (EAN), 4621300253 (ISBN)
- 評価
著者のひとりは(あの「バイブル」とも呼ばれる)通称 “K&R” の K のほうである。この本は Go 言語の教科書と言ってもいいだろう。と思ったら絶版状態らしい(2025-01 現在)。復刊を望む!
- 初めてのGo言語 ―他言語プログラマーのためのイディオマティックGo実践ガイド
- Jon Bodner (著), 武舎 広幸 (翻訳)
- オライリージャパン 2022-09-26
- 単行本(ソフトカバー)
- 4814400047 (ASIN), 9784814400041 (EAN), 4814400047 (ISBN)
- 評価
2021年に出た “Learning Go” の邦訳版。私は版元で PDF 版を購入。 Go 特有の語法(idiom)を切り口として Go の機能やパッケージを解説している。 Go 1.19 対応。