============================================================================= FreeBSD-SA-02:01 Security Advisory FreeBSD, Inc. トピック: pkg_add におけるディレクトリのパーミッション問題(改訂版) (Directory permission vulnerability in pkg_add [REVISED]) カテゴリ: core モジュール: pkg_install 告知日: 2002-01-04 改訂日: 2002-01-07 クレジット: The Anarcat 影響範囲: 修正日より前の全てのバージョンの FreeBSD 修正日: 2001/11/22 17:40:36 UTC (4.4-STABLE aka RELENG_4) 2001/12/07 20:58:46 UTC (4.4-RELEASEp1 aka RELENG_4_4) 2001/12/07 20:57:19 UTC (4.3-RELEASEp21 aka RELENG_4_3) FreeBSD 固有: NO 0. 改訂履歴 - Revision History v1.0 2002-01-04 Initial release v1.1 2002-01-07 Correct terminology in problem description. v1.0 2002-01-04 初版 v1.1 2002-01-07 「問題の詳細」の項の用語を修正 I. 背景 - Background pkg_add is a utility program used to install software package distributions on FreeBSD systems. pkg_add は FreeBSD システムにソフトウェアの package をインストール するためのユーティリティです。 II. 問題の詳細 - Problem Description pkg_add extracts the contents of the package to a temporary directory, then moves files from the temporary directory to their ultimate destination on the system. The temporary directory used in the extraction was created with world-searchable permissions, allowing arbitrary users to examine the contents of the package as it was being extracted. This might allow users to attack world-writable parts of the package during installation. pkg_add は package の中身を一度テンポラリディレクトリに展開し、その あと各ファイルが置かれるべきディレクトリにファイルを移動します。この テンポラリディレクトリは world-searchable なパーミッションで作成される ため、パッケージが展開されているときは、誰でも package の中身を調べる ことができてしまいます。また、インストール中に package 中の world- writable なファイルに変更を加えることも可能です。 III. 影響範囲 - Impact A local attacker may be able to modify the package contents and potentially elevate privileges or otherwise compromise the system. There are no known exploits as of the date of this advisory. ローカルの攻撃者は package の中身を変更することで、権限を昇格したり、 システムを攻略したりできる可能性があります。この勧告が発行された時点 では、この問題を利用した攻撃法はまだ知られていません。 IV. 回避方法 - Workaround 1) Remove or discontinue use of the pkg_add binary until it has been upgraded. 1) pkg_add をアップグレードするまでは、そのバイナリを削除するか、 使用を中止するようにします。 2) When running pkg_add, create a secure temporary directory (such as /var/tmp/inst) and secure the directory permissions (chmod 700 /var/tmp/inst). Set the TMPDIR environment variable to this directory before running pkg_add. 2) pkg_add の実行する際、安全なパーミッションを設定したテンポラリ ディレクトリを作成します。 mkdir /var/tmp/inst chmod 700 /var/tmp/inst pkg_add を実行する前に、環境変数 TMPDIR に作成したディレクトリの パスをセットします。 V. 解決法 - Solution 1) Upgrade your vulnerable FreeBSD system to 4.4-STABLE, or the RELENG_4_4 or RELENG_4_3 security branches dated after the respective correction dates. 1) 脆弱性のある FreeBSD システムを、修正日以降の 4.4-STABLE や、 RELENG_4_4、RELENG_4_3 セキュリティブランチにアップグレードします。 2) FreeBSD 4.x systems prior to the correction date: 2) 修正日以前の FreeBSD 4.x システムの場合: The following patch has been verified to apply to FreeBSD 4.3-RELEASE, 4.4-RELEASE, and 4-STABLE dated prior to the correction date. This patch may or may not apply to older, unsupported releases of FreeBSD. 以下のパッチは、FreeBSD 4.3-RELEASE、4.4-RELEASE、および修正日以前の 4-STABLE への適用を確認済みです。これより古い、サポートされていない リリースへは適用できない可能性があります。 Download the patch and the detached PGP signature from the following locations, and verify the signature using your PGP utility. 以下の場所からパッチと PGP 署名をダウンロードし、PGP ユーティリティを 使って署名を確認します。 ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:01/pkg_add.patch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:01/pkg_add.patch.asc Execute the following commands as root: root で以下のコマンドを実行します: # cd /usr/src # patch -p < /path/to/patch # cd /usr/src/usr.sbin/pkg_install # make depend && make all install VI. 修正の詳細 - Correction details The following list contains the $FreeBSD$ revision numbers of each file that was corrected in the FreeBSD source 以下は FreeBSD のソース中で修正された各ファイルの $FreeBSD$ リビジョン 番号のリストです。 Path Revision Branch - ------------------------------------------------------------------------- src/usr.sbin/pkg_install/lib/pen.c HEAD 1.37 RELENG_4 1.31.2.6 RELENG_4_4 1.31.2.2.2.1 RELENG_4_3 1.31.2.1.2.1 - ------------------------------------------------------------------------- VII. 参考文献 - References