Go 1.17.2 のリリース【セキュリティ・アップデート】
今回は1件の脆弱性修正を含んでいる。
go1.17.2 (released 2021-10-07) includes a security fix to the linker and.misc/wasm
directory, as well as bug fixes to the compiler, the runtime, the go command, and to thetime
andtext/template
packages. See the Go 1.17.2 milestone on our issue tracker for details
CVE-2021-38297
When invoking functions from WASM modules, built using
GOARCH=wasm GOOS=js
, passing very large arguments can cause portions of the module to be overwritten with data from the arguments.If using
wasm_exec.js
to execute WASM modules, users will need to replace their copy (as described in https://golang.org/wiki/WebAssembly#getting-started) after rebuilding any modules.
というわけで wasm_exec.js
ファイルの置き換えが必要らしい。
1.17.1 の wasm_exec.js
ファイルとで diff をとってみたら
$ diff -u go1.17.1/misc/wasm/wasm_exec.js go1.17.2/misc/wasm/wasm_exec.js
--- go1.17.1/misc/wasm/wasm_exec.js 2021-09-10 00:41:20.000000000 +0900
+++ go1.17.2/misc/wasm/wasm_exec.js 2021-10-08 04:58:29.000000000 +0900
@@ -567,6 +567,13 @@
offset += 8;
});
+ // The linker guarantees global data starts from at least wasmMinDataAddr.
+ // Keep in sync with cmd/link/internal/ld/data.go:wasmMinDataAddr.
+ const wasmMinDataAddr = 4096 + 4096;
+ if (offset >= wasmMinDataAddr) {
+ throw new Error("command line too long");
+ }
+
this._inst.exports.run(argc, argv);
if (this.exited) {
this._resolveExitPromise();
とチェック用の条件文が追加されているだけのようだ。
以下は CVSSv3.1 による評価。
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- 深刻度: 緊急 (Score: 9.8)
基本評価基準 | 評価値 |
---|---|
攻撃元区分 | ネットワーク |
攻撃条件の複雑さ | 低 |
必要な特権レベル | 不要 |
ユーザ関与レベル | 不要 |
スコープ | 変更なし |
機密性への影響 | 高 |
完全性への影響 | 高 |
可用性への影響 | 高 |
例によって…
Ubuntu の APT で管理している Go コンパイラは古いので,ダウンロードページからバイナリ(go1.17.2.linux-amd64.tar.gz
)を取ってきて手動でインストールすることを強く推奨する。
以下は手動での作業例。
$ cd /usr/local/src
$ sudo curl -L "https://golang.org/dl/go1.17.2.linux-amd64.tar.gz" -O
$ cd ..
$ sudo unlink go # 以前の Go が入っている場合
$ sudo tar xvf src/go1.17.2.linux-amd64.tar.gz
$ sudo mv go go1.17.2
$ sudo ln -s go1.17.2 go
$ go version # /usr/local/go/bin にパスが通っている場合
go version go1.17.2 linux/amd64
アップデートは計画的に。
参考図書
- プログラミング言語Go
- アラン・ドノバン (著), ブライアン・カーニハン (著), 柴田芳樹 (著)
- 丸善出版 2016-06-20 (Release 2021-07-13)
- Kindle版
- B099928SJD (ASIN)
- 評価
Kindle 版出た! 一部内容が古びてしまったが,この本は Go 言語の教科書と言ってもいいだろう。感想はこちら。