Go 1.21.1 のリリース【セキュリティ・アップデート】

no extension

毎度遅まきながらでごめんペコン。 予告どおり Go 1.21.1 がリリースされた。

今回は CVE ID ベースで5件の脆弱性修正を含んでいる。

CVE-2023-39320 cmd/go: go.mod toolchain directive allows arbitrary execution

The go.mod toolchain directive, introduced in Go 1.21, could be leveraged to execute scripts and binaries relative to the root of the module when the “go” command was executed within the module. This applies to modules downloaded using the “go” command from the module proxy, as well as modules downloaded directly using VCS software.

またコマンドの任意実行か。 ヤバいやつ。

  • CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
  • 深刻度: 緊急 (Score: 9.8)
基本評価基準 評価値
攻撃元区分 ネットワーク
攻撃条件の複雑さ
必要な特権レベル 不要
ユーザ関与レベル 不要
スコープ 変更なし
機密性への影響
完全性への影響
可用性への影響

CVE-2023-39318 html/template: improper handling of HTML-like comments within script contexts

The html/template package did not properly handle HMTL-like “<!--” and “-->” comment tokens, nor hashbang “#!” comment tokens, in <script> contexts. This may cause the template parser to improperly interpret the contents of <script> contexts, causing actions to be improperly escaped. This could be leveraged to perform an XSS attack.
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
  • 深刻度: 警告 (Score: 6.1)
基本評価基準 評価値
攻撃元区分 ネットワーク
攻撃条件の複雑さ
必要な特権レベル 不要
ユーザ関与レベル
スコープ 変更あり
機密性への影響
完全性への影響
可用性への影響 なし

CVE-2023-39319 crypto/tls: panic when processing post-handshake message on QUIC connections

The html/template package did not apply the proper rules for handling occurrences of “<script”, “<!--”, and “</script” within JS literals in <script> contexts. This may cause the template parser to improperly consider script contexts to be terminated early, causing actions to be improperly escaped. This could be leveraged to perform an XSS attack.
  • CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
  • 深刻度: 警告 (Score: 6.1)
基本評価基準 評価値
攻撃元区分 ネットワーク
攻撃条件の複雑さ
必要な特権レベル 不要
ユーザ関与レベル
スコープ 変更あり
機密性への影響
完全性への影響
可用性への影響 なし

CVE-2023-39321, CVE-2023-39322 html/template: improper handling of special tags within script contexts

Processing an incomplete post-handshake message for a QUIC connection caused a panic.

CVE ID ベースでは2件だけど CVSS 評価は同じのようだ。

  • CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
  • 深刻度: 重要 (Score: 7.5)
基本評価基準 評価値
攻撃元区分 ネットワーク
攻撃条件の複雑さ
必要な特権レベル 不要
ユーザ関与レベル 不要
スコープ 変更なし
機密性への影響 なし
完全性への影響 なし
可用性への影響

例によって…

Ubuntu の APT で管理している Go コンパイラは古いので,ダウンロードページからバイナリ(go1.21.1.linux-amd64.tar.gz)を取ってきてインストールすることを推奨する。 以下は完全手動での作業例。

$ cd /usr/local/src
$ sudo curl -L "https://go.dev/dl/go1.21.1.linux-amd64.tar.gz" -O
$ cd ..
$ sudo unlink go # 以前の Go が入っている場合
$ sudo tar xvf src/go1.21.1.linux-amd64.tar.gz
$ sudo mv go go1.21.1
$ sudo ln -s go1.21.1 go
$ go version # /usr/local/go/bin にパスが通っている場合
go version go1.21.1 linux/amd64

Windows はインストールパッケージを取ってきて直接インストールする。 Scoop 経由でも OK

複数バージョンの Go コンパイラを扱いたい場合は

$ go install golang.org/dl/go1.21.1@latest
$ go1.21.1 download
$ go1.21.1 version
go version go1.21.1 linux/amd64

てな感じに導入できる。

アップデートは計画的に。

参考図書

photo
プログラミング言語Go
アラン・ドノバン (著), ブライアン・カーニハン (著), 柴田芳樹 (著)
丸善出版 2016-06-20 (Release 2021-07-13)
Kindle版
B099928SJD (ASIN)
評価     

Kindle 版出た! 一部内容が古びてしまったが,この本は Go 言語の教科書と言ってもいいだろう。感想はこちら

reviewed by Spiegel on 2021-05-22 (powered by PA-APIv5)

photo
初めてのGo言語 ―他言語プログラマーのためのイディオマティックGo実践ガイド
Jon Bodner (著), 武舎 広幸 (翻訳)
オライリージャパン 2022-09-26
単行本(ソフトカバー)
4814400047 (ASIN), 9784814400041 (EAN), 4814400047 (ISBN)
評価     

2021年に出た “Learning Go” の邦訳版。私は版元で PDF 版を購入。 Go 特有の語法(idiom)を切り口として Go の機能やパッケージを解説している。 Go 1.19 対応。

reviewed by Spiegel on 2022-10-11 (powered by PA-APIv5)

photo
Go言語 100Tips ありがちなミスを把握し、実装を最適化する impress top gearシリーズ
Teiva Harsanyi (著), 柴田 芳樹 (著)
インプレス 2023-08-18 (Release 2023-08-18)
Kindle版
B0CFL1DK8Q (ASIN)
評価     

版元で PDF 版を購入可能。事実上の Effective Go とも言える充実の内容。オリジナルは敢えてタイトルに “tips” という単語を入れるのを避けたのに邦題が「100 Tips」とかなっていて,原作者がお怒りとの噂(あくまで噂)

reviewed by Spiegel on 2023-08-18 (powered by PA-APIv5)