FreeBSD-SA-05:11.gzip "gzip directory traversal and permission race vulnerabilities"

The FreeBSD Project よりセキュリティ勧告が出ました。要点を以下にまとめます。

  • 未稿

セキュリティ勧告は ftp://ftp.freebsd.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-05:11.gzip.asc にあります。
以下は上記のセキュリティ勧告の一部とその訳文です。ただし品質は保証致しません。

I. 背景 - Background

gzip is a file compression utility.
gzipはファイル圧縮ユーティリィティです。

II. 問題の詳細 - Problem Description

Two problems related to extraction of files exist in gzip:
gzipにはファイルの抽出と関係する2つの問題が存在します:
The first problem is that gzip does not properly sanitize filenames containing "/" when uncompressing files using the -N command line option.
第1の問題は、-Nコマンドラインオプションを使用してファイルを展開する場合に、gzipが「/」を含んでいるファイル名を適切にサニタイズにしないということです。
The second problem is that gzip does not set permissions on newly extracted files until after the file has been created and the file descriptor has been closed.
第2の問題は、ファイルを作成し、ファイルディスクリプタを閉じるまで、gzipが新しく抽出したファイルにパーミッションをセットしないということです。

III. 影響範囲 - Impact

The first problem can allow an attacker to overwrite arbitrary local files when uncompressing a file using the -N command line option.
第1の問題により、-Nコマンドライン・オプションを使用してファイルを展開する場合、攻撃者は任意のローカルファイルを上書きすることが可能となります。
The second problem can allow a local attacker to change the permissions of arbitrary local files, on the same partition as the one the user is uncompressing a file on, by removing the file the user is uncompressing and replacing it with a hardlink before the uncompress operation is finished.
第2の問題により、ローカルな攻撃者は展開作業が終了する前に展開しているファイルを削除し、それをhardlinkによって取り替えることにより、ユーザが展開しているファイルと同じパーティション上の任意のローカルファイルのパーミッションを変更することが可能となります。

IV. 回避方法 - Workaround

Do not use the -N command line option on untrusted files and do not uncompress files in directories where untrusted users have write access.
信頼されないファイルに対し-Nコマンドラインオプションを使用しないでください。また、信頼されないユーザが書き込みアクセスを持っているディレクトリ中でファイルを解凍しないでください。

><