Go 1.19.2 のリリース【セキュリティ・アップデート】
遅まきながらで申し訳ないが,予告通りに先日 Go 1.19.2 がリリースされた。
今回は3件の脆弱性修正を含んでいる。
go1.19.2 (released 2022-10-04) includes security fixes to thearchive/tar
,net/http/httputil
, andregexp
packages, as well as bug fixes to the compiler, the linker, the runtime, and thego/types
package. See the Go 1.19.2 milestone on our issue tracker for details.
CVE-2022-2879 archive/tar: unbounded memory consumption when reading headers
Reader.Read
did not set a limit on the maximum size of file headers. A maliciously crafted archive could cause Read to allocate unbounded amounts of memory, potentially causing resource exhaustion or panics.Reader.Read
now limits the maximum size of header blocks to 1 MiB.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- 深刻度: 重要 (Score: 7.5)
基本評価基準 | 評価値 |
---|---|
攻撃元区分 | ネットワーク |
攻撃条件の複雑さ | 低 |
必要な特権レベル | 不要 |
ユーザ関与レベル | 不要 |
スコープ | 変更なし |
機密性への影響 | なし |
完全性への影響 | なし |
可用性への影響 | 高 |
CVE-2022-2880 net/http/httputil: ReverseProxy should not forward unparseable query parameters
Requests forwarded by
ReverseProxy
included the raw query parameters from the inbound request, including unparseable parameters rejected bynet/http
. This could permit query parameter smuggling when a Go proxy forwards a parameter with an unparseable value.
ReverseProxy
will now sanitize the query parameters in the forwarded query when the outbound request’s Form field is set after theReverseProxy.Director
function returns, indicating that the proxy has parsed the query parameters. Proxies which do not parse query parameters continue to forward the original query parameters unchanged.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
- 深刻度: 重要 (Score: 7.5)
基本評価基準 | 評価値 |
---|---|
攻撃元区分 | ネットワーク |
攻撃条件の複雑さ | 低 |
必要な特権レベル | 不要 |
ユーザ関与レベル | 不要 |
スコープ | 変更なし |
機密性への影響 | なし |
完全性への影響 | 高 |
可用性への影響 | なし |
CVE-2022-41715 regexp/syntax: limit memory used by parsing regexps
The parsed
regexp
representation is linear in the size of the input, but in some cases the constant factor can be as high as 40,000, making relatively small regexps consume much larger amounts of memory.Each
regexp
being parsed is now limited to a 256 MB memory footprint. Regular expressions whose representation would use more space than that are now rejected. Normal use of regular expressions is unaffected.
$ go run main.go CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
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.19.2.linux-amd64.tar.gz
)を取ってきてインストールすることを強く推奨する。
以下は完全手動での作業例。
$ cd /usr/local/src
$ sudo curl -L "https://go.dev/dl/go1.19.2.linux-amd64.tar.gz" -O
$ cd ..
$ sudo unlink go # 以前の Go が入っている場合
$ sudo tar xvf src/go1.19.2.linux-amd64.tar.gz
$ sudo mv go go1.19.2
$ sudo ln -s go1.19.2 go
$ go version # /usr/local/go/bin にパスが通っている場合
go version go1.19.2 linux/amd64
Windows は Scoop 経由で OK
アップデートは計画的に。
【2022-10-13 追記】 govulncheck コマンドが役に立った
最近 govulncheck を GitHub Actions のワークフローに仕込んでいるのだが,今回の脆弱性をちゃんと検出してくれたようだ。

よーし,うむうむ,よーし。
参考図書
- プログラミング言語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 対応。