Go 1.20.1 のリリース【セキュリティ・アップデート】
予告通り 2023-02-15 (日本時間) に Go 1.20.1 がリリースされた。
今回は4件の脆弱性修正を含んでいる。
CVE-2022-41722 path/filepath: path traversal in filepath.Clean on Windows
On Windows, thefilepath.Clean
function could transform an invalid path such asa/../c:/b
into the valid pathc:\b
. This transformation of a relative (if invalid) path into an absolute path could enable a directory traversal attack. The filepath.Clean function will now transform this path into the relative (but still invalid) path.\c:\b
.
相変わらず Windows のパス構成は面倒くさいよな。
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
- 深刻度: 重要 (Score: 7.5)
基本評価基準 | 評価値 |
---|---|
攻撃元区分 | ネットワーク |
攻撃条件の複雑さ | 低 |
必要な特権レベル | 不要 |
ユーザ関与レベル | 不要 |
スコープ | 変更なし |
機密性への影響 | 高 |
完全性への影響 | なし |
可用性への影響 | なし |
CVE-2022-41725 net/http, mime/multipart: denial of service from excessive resource consumption
文章が長いので,一部端折っている。 ごめんペコン。
Multipart form parsing with
mime/multipart.Reader.ReadForm
can consume largely unlimited amounts of memory and disk files. This also affects form parsing in thenet/http
package with theRequest
methodsFormFile
,FormValue
,ParseMultipartForm
, andPostFormValue
.[…]
ReadForm
now properly accounts for various forms of memory overhead, and should now stay within its documented limit of 10MB +maxMemory
bytes of memory consumption. Users should still be aware that this limit is high and may still be hazardous.
ReadForm
now creates at most one on-disk temporary file, combining multiple form parts into a single temporary file. Themime/multipart.File
interface type’s documentation states, “If stored on disk, theFile
’s underlying concrete type will be an*os.File
.”. This is no longer the case when a form contains more than one file part, due to this coalescing of parts into a single file. The previous behavior of using distinct files for each form part may be reenabled with the environment variableGODEBUG=multipartfiles=distinct
.Users should be aware that
multipart.ReadForm
and thehttp.Request
methods that call it do not limit the amount of disk consumed by temporary files. Callers can limit the size of form data withhttp.MaxBytesReader
.
とあるように,コンパイラを入れ替えれば OK とは必ずしもならないのでご注意を。
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- 深刻度: 重要 (Score: 7.5)
基本評価基準 | 評価値 |
---|---|
攻撃元区分 | ネットワーク |
攻撃条件の複雑さ | 低 |
必要な特権レベル | 不要 |
ユーザ関与レベル | 不要 |
スコープ | 変更なし |
機密性への影響 | なし |
完全性への影響 | なし |
可用性への影響 | 高 |
CVE-2022-41724 crypto/tls: large handshake records may cause panics
Both clients and servers may send large TLS handshake records which cause servers and clients, respectively, to panic when attempting to construct responses.
This affects all TLS 1.3 clients, TLS 1.2 clients which explicitly enable session resumption (by setting
Config.ClientSessionCache
to a non-nil value), and TLS 1.3 servers which request client certificates (by settingConfig.ClientAuth
>=RequestClientCert
).
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- 深刻度: 重要 (Score: 7.5)
基本評価基準 | 評価値 |
---|---|
攻撃元区分 | ネットワーク |
攻撃条件の複雑さ | 低 |
必要な特権レベル | 不要 |
ユーザ関与レベル | 不要 |
スコープ | 変更なし |
機密性への影響 | なし |
完全性への影響 | なし |
可用性への影響 | 高 |
CVE-2022-41723 net/http: avoid quadratic complexity in HPACK decoding
A maliciously crafted HTTP/2 stream could cause excessive CPU consumption in the HPACK decoder, sufficient to cause a denial of service from a small number of small requests.
This issue is also fixed in
golang.org/x/net/http2
v0.7.0, for users manually configuring HTTP/2.
上述のとおり golang.org/x/net/http2
v0.7.0 でも同様の修正がされているそうなので,心当たりの方はアップデートを。
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- 深刻度: 重要 (Score: 7.5)
基本評価基準 | 評価値 |
---|---|
攻撃元区分 | ネットワーク |
攻撃条件の複雑さ | 低 |
必要な特権レベル | 不要 |
ユーザ関与レベル | 不要 |
スコープ | 変更なし |
機密性への影響 | なし |
完全性への影響 | なし |
可用性への影響 | 高 |
CVE-2022-41727 Vulnerability in golang.org/x/image/tiff
標準パッケージではないが golang.org/x/image
v0.5.0 でも脆弱性の修正が行われている。
Version v0.5.0 of
golang.org/x/image
fixes a vulnerability in thegolang.org/x/image/tiff
package which could cause a denial of service.An attacker can craft a malformed TIFF image which will consume a significant amount of memory when passed to
DecodeConfig
.
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H
- 深刻度: 警告 (Score: 5.5)
基本評価基準 | 評価値 |
---|---|
攻撃元区分 | ローカル |
攻撃条件の複雑さ | 低 |
必要な特権レベル | 不要 |
ユーザ関与レベル | 要 |
スコープ | 変更なし |
機密性への影響 | なし |
完全性への影響 | なし |
可用性への影響 | 高 |
例によって…
Ubuntu の APT で管理している Go コンパイラは古いので,ダウンロードページからバイナリ(go1.20.1.linux-amd64.tar.gz
)を取ってきてインストールすることを推奨する。
以下は完全手動での作業例。
$ cd /usr/local/src
$ sudo curl -L "https://go.dev/dl/go1.20.1.linux-amd64.tar.gz" -O
$ cd ..
$ sudo unlink go # 以前の Go が入っている場合
$ sudo tar xvf src/go1.20.1.linux-amd64.tar.gz
$ sudo mv go go1.20.1
$ sudo ln -s go1.20.1 go
$ go version # /usr/local/go/bin にパスが通っている場合
go version go1.20.1 linux/amd64
Windows はインストールパッケージを取ってきて直接インストールする。 Scoop 経由でも OK
アップデートは計画的に。
ブックマーク
参考図書
- プログラミング言語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 対応。
- 実用 Go言語 ―システム開発の現場で知っておきたいアドバイス
- 渋川 よしき (著), 辻 大志郎 (著), 真野 隼記 (著)
- オライリージャパン 2022-04-22
- 単行本(ソフトカバー)
- 4873119693 (ASIN), 9784873119694 (EAN), 4873119693 (ISBN)
- 評価
版元のデジタル版を購入。 Go で躓きやすい点を解説していくのが最初の動機らしい。「◯◯するには」を調べる際にこの本を調べるといいかも。