============================================================================= FreeBSD-SA-02:09 Security Advisory FreeBSD, Inc. トピック: fstatfs のレースコンディションが procfs を利用した サービス拒否攻撃の影響を受ける (fstatfs race condition may allow local denial of service via procfs) カテゴリ: core モジュール: kernel 告知日: 2002-02-06 クレジット: Stefan Esser 影響範囲: 4.5-RELEASE より前のすべてのバージョンの FreeBSD 修正日: 2002-01-07 20:47:34 UTC (RELENG_4) 2002-01-17 15:46:46 UTC (RELENG_4_4) 2002-01-17 15:47:04 UTC (RELENG_4_3) FreeBSD 固有: YES I. 背景 - Background fstatfs() is a function that retrieves filesystem statistics in the kernel. procfs is the process filesystem, which presents a filesystem interface to the system process table and associated data. fstatfs() は kernel 内のファイルシステムの統計情報を得るための 関数です。procfs はプロセスファイルシステムのことで、システムの プロセステーブルやそれに関連するデータへのファイルシステムを 利用したインターフェイスを提供します。 II. 問題の詳細 - Problem Description A race condition existed where a file could be removed between calling fstatfs() and the point where the file is accessed causing the file descriptor to become invalid. This may allow unprivileged local users to cause a kernel panic. Currently only the procfs filesystem is known to be vulnerable. fstatfs() が呼ばれてから実際にファイルがアクセスされるまでの間に、 そのファイルを削除してファイルディスクリプタを無効にしてしまう ことができるレースコンディションが存在します。これによって、高い 権限をもたないユーザがカーネルパニックを引き起こすことができて しまいます。現時点では、procfs ファイルシステムがこの問題の影響を 受けることが知られています。 III. 影響範囲 - Impact On vulnerable FreeBSD systems where procfs is mounted, unprivileged local users may be able to cause a kernel panic. 脆弱性のある FreeBSD システムに procfs がマウントされている場合、 高い権限を持たないローカルユーザによってカーネルパニックが引き 起こされる可能性があります。 IV. 回避方法 - Workaround Unmount all instances of the procfs filesystem using the umount(8) command by performing the following as root: root 権限で以下のようにして umount(8) コマンドを実行し、マウント されている全ての procfs ファイルシステムをアンマウントします。 # umount -f -a -t procfs Disable the automatic mounting of all instances of procfs in /etc/fstab, remove or comment out the line(s) of the following form: /etc/fstab を修正し、procfs が自動的にマウントされないようにします。 以下のような行を削除するか、コメントアウトしてください。 proc /proc procfs rw 0 0 Note that unmounting procfs may have a negative impact on the operation of the system: under older versions of FreeBSD it is required for some aspects of the ps(1) command, and unmounting it may also break use of userland inter-process debuggers such as gdb. Other installed binaries including emulated Linux binaries may require access to procfs for correct operation. procfs をアンマウントした場合、システムの動作に悪影響を及ぼす可能性が あることに注意してください。古いバージョンの FreeBSD では、ps(1) コマンドの一部で procfs が必要ですし、gdb のようなユーザランドでの プロセス間デバッガも使用できなくなるでしょう。エミュレーション用の Linux バイナリを含む、インストールされている他のバイナリにも、正常 な動作のために procfs へのアクセスを必要とするものがあります。 V. 解決法 - Solution 1) Upgrade your vulnerable FreeBSD system to 4.5-RELEASE or 4.5-STABLE, or the RELENG_4_5, RELENG_4_4, or RELENG_4_3 security branches dated after their respective correction dates. 1) 脆弱性のある FreeBSD システムを、4.5-RELEASE や 4.5-STABLE、 RELENG_4_5、および修正日以降の 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 all FreeBSD 4.x releases dated prior to the correction date. This patch may or may not apply to older, unsupported releases of FreeBSD. 以下のパッチは、修正日より前の全ての FreeBSD 4.x リリースへの 適用を確認済みです。それ以前にリリースされたサポート外の FreeBSD への適用は未確認です。 Download the patch and the detached PGP signature from the following locations, and verify the signature using your PGP utility. 以下の場所からパッチと PGP 署名をダウンロードし、PGP ユーティリティを 使って署名を確認します。 # fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:09/fstatfs.patch # fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:09/fstatfs.patch.asc Execute the following commands as root: root 権限で以下のコマンドを実行します: # cd /usr/src # patch -p < /path/to/patch If procfs is statically compiled into the kernel (i.e. the kernel configuration file contains the line 'options PROCFS'), rebuild and reinstall your kernel as described in http://www.freebsd.org/handbook/kernelconfig.html and reboot the system with the new kernel for the changes to take effect. procfs がカーネルに静的にリンクされている場合(つまりカーネルの 設定ファイルに 'options PROCFS' という行がある場合)は、 http://www.freebsd.org/handbook/kernelconfig.html の説明に 従ってカーネルを再構築・再インストールした後、修正を有効にする ためにシステムを再起動します。 If procfs is dynamically loaded by KLD (use the kldstat command to verify whether this is the case) and the system securelevel has not been raised, the system can be patched at run-time without requiring a reboot by the execution of the following commands after patching the source as described above: また、procfs が KLD によって動的にロードされる場合(kldstat コマンドを 使用して確認できます)で、システムの securelevel を上げていない場合は、 上記の方法でソースにパッチを当てたあと以下のコマンドを実行することで、 システムを再起動することなくパッチを適用することができます。 # cd /usr/src/sys/modules/procfs # make depend && make all install # umount -f -a -t procfs # kldunload procfs # kldload procfs # mount -a -t procfs VI. 修正の詳細 - Correction details The following list contains the $FreeBSD$ revision numbers of the file that was corrected in the FreeBSD source. 以下のリストは、FreeBSD のソース中で今回修正されたファイルの $FreeBSD$ リビジョン番号です。 Path Revision Branch - ------------------------------------------------------------------------- src/sys/kern/vfs_syscalls.c HEAD 1.216 RELENG_4 1.151.2.13 RELENG_4_4 1.151.2.9.2.1 RELENG_4_3 1.151.2.7.2.1 - ------------------------------------------------------------------------- VII. 参考資料 - References