============================================================================= FreeBSD-SA-02:08 Security Advisory FreeBSD, Inc. トピック: exec システムコール中のレースコンディションにより ローカルから root 権限が奪取される (race condition during exec may allow local root compromise) カテゴリ: core モジュール: kernel 告知日: 2002-01-24 クレジット: Logan Gabriel , Robert Watson , Dag-Erling Smgrav 影響範囲: 4.5-RELEASE より前の全ての FreeBSD 4.x 修正日より前の FreeBSD 4.4-STABLE 修正日: 2002-01-22 17:22:59 UTC (4-STABLE, RELENG_4) 2002-01-23 23:05:00 UTC (4.4-RELEASE-p4, RELENG_4_4) 2002-01-23 23:05:53 UTC (4.3-RELEASE-p24, RELENG_4_3) FreeBSD 固有: NO I. 背景 - Background When a process is started from a set-user-ID or set-group-ID binary, it is marked so that attempts to attach to it with debugging hooks fail. To allow such attachments would allow a user to subvert the process and gain elevated privileges. セットユーザ ID、またはセットグループ ID されたバイナリが起動される 際には、デバッグ用のフックを行おうとしても失敗してしまうようにマーク されるようになっています。これは、このようなフックを悪用すると一般 ユーザが高い権限を獲得できてしまうためです。 II. 問題の詳細 - Problem Description A race condition exists in the FreeBSD exec system call implementation. It is possible for a user to attach a debugger to a process while it is exec'ing, but before the kernel has determined that the process is set-user-ID or set-group-ID. FreeBSD の exec システムコールの実装にはレースコンディションが存在し ます。これは、セットユーザ ID、セットグループ ID されたバイナリを起動 した際、カーネルがプロセスのユーザ ID やグループ ID をセットする前に、 デバッガをそのプロセスに結びつけてしまうことができるというものです。 All versions of FreeBSD 4.x prior to FreeBSD 4.5-RELEASE are vulnerable to this problem. The problem has been corrected by marking processes that have started but not yet completed exec with an `in-exec' state. Attempts to debug a process in the in-exec state will fail. FreeBSD 4.5-RELEASE より前の全てのバージョンの FreeBSD 4.x がこの問題の 影響を受けます。この問題は、プロセスを起動する exec システムコールが完了 する前の `in-exec' 状態のうちに、デバッグ用のフックを禁止するマークを 行うという方法で修正されました。`in-exec' 状態のプロセスは、デバッグしよ うとしても失敗するようになっています。 III. 影響範囲 - Impact Local users may be able to gain increased privileges on the local system. ローカルユーザが、ローカルシステム上で権限を昇格することができます。 IV. 回避方法 - Workaround None. Do not allow untrusted users to gain access to the local system. ありません。信頼できないユーザには、ローカルシステムへのアクセスを 増やさせないようにしてください。 V. 解決法 - Solution One of the following: 以下のいずれかを行います: 1) Upgrade your vulnerable FreeBSD system to 4.4-STABLE, or the RELENG_4_3 or RELENG_4_4 security branch, dated after the respective correction date. 1) 問題のある FreeBSD システムを、修正日以降の 4.4-STABLE や RELENG_4_3 、RELENG_4_4 セキュリティブランチへアップグレードします。 2) To patch your present system: 2) 現在のシステムにパッチを当てます: a) Download the relevant patch from the following location: a) 以下の場所から適切なパッチをダウンロードします: [FreeBSD 4.4-STABLE, or RELENG_4_3 and RELENG_4_4 security branches] ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:08/exec.patch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:08/exec.patch.asc [FreeBSD 4.3-RELEASE only] ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:08/exec-43R.patch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:08/exec-43R.patch.asc b) Verify the detached PGP signature using your PGP utility. b) PGP ユーティリティを使って PGP 署名を確認します。 c) Execute the following commands as root: c) root 権限で以下のコマンドを実行します: # cd /usr/src # patch -p < /path/to/patch Recompile your kernel as described in http://www.freebsd.org/handbook/kernelconfig.html and reboot the system. 以下の URL を参照してカーネルを再構築し、システムを再起動します。 http://www.jp.freebsd.org/www.FreeBSD.org/ja/handbook/kernelconfig.html 3) FreeBSD 4.4-RELEASE systems: 3) FreeBSD 4.4-RELEASE システムの場合: An experimental upgrade package is available for users who wish to provide testing and feedback on the binary upgrade process. This package may be installed on FreeBSD 4.4-RELEASE systems only, and is intended for use on systems for which source patching is not practical or convenient. バイナリのアップグレード処理のテストとフィードバックを希望するユーザ のために、実験的なアップグレード package が利用できます。この package は、ソースへのパッチ当てが不可能だったり、不都合だったりするシステムで の利用を意図しており、FreeBSD 4.4-RELEASE システムのみにインストール することができます。 If you use the upgrade package, feedback (positive or negative) to security-officer@FreeBSD.org is requested so we can improve the process for future advisories. このアップグレード package を使用する場合は、将来の勧告に向けてこの 処理を改良していくため、security-officer@FreeBSD.org へフィードバック (肯定的な意見でも否定的な意見でも構いません)をお願いします。 Since this vulnerability involves the FreeBSD kernel which is often locally customized on installed systems, a universal binary upgrade package is not feasible. This package includes a patched version of the GENERIC kernel which should be suitable for use on many systems. Systems requiring a customized kernel must use an alternative solution. この脆弱性は、システムごとにカスタマイズされていることの多い FreeBSD の カーネルに含まれているため、共通のバイナリアップグレードパッケージは 利用できません。このパッチには、パッチを適用済みの汎用な GENERIC カー ネルが含まれています。カーネルのカスタマイズを必要とするシステムの場合 は、別の解決法を実行する必要があります。 During the installation procedure, backup copies are made of the files which are replaced by the package. These backup copies will be reinstalled if the package is removed, reverting the system to a pre-patched state. インストール処理の実行中に、package によって置き換えられるファイルの バックアップコピーが作成されます。package が削除されと、このバックアッ プコピーが再びインストールされ、システムはパッチを当てる前の状態に戻り ます。 # fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/packages/SA-02:08/security-patch-exec-02.08.tgz # fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/packages/SA-02:08/security-patch-exec-02.08.tgz.asc Verify the detached PGP signature using your PGP utility. PGP ユーティリティを使って PGP 署名を確認します。 # pkg_add security-patch-exec-02.08.tgz The new kernel is named /kernel.GENERIC to avoid conflict with the default kernel name (``/kernel''). To cause the system to boot automatically with the new kernel, add the following line to /boot/loader.conf: 新しいカーネルは、デフォルトの名前(``/kernel'')と衝突しないように /kernel.GENERIC という名前になっています。システムが自動的に新しい カーネルから起動するように、/boot/loader.conf ファイルに以下の行を 追加します。 kernel="/kernel.GENERIC" and reboot the system to load the new kernel. The old kernel is still available and can be manually loaded in the boot loader in case of problems. そして、新しいカーネルをロードするためにシステムを再起動します。古い カーネル(``/kernel'')も引き続き使用可能なので、新しいカーネルに何か 問題があった場合は、ブートローダからマニュアルで古いカーネルをロード することができます。 VI. 修正の詳細 - Correction details The following list contains the $FreeBSD$ revision number of the files that were corrected in the FreeBSD source. 以下のリストは、FreeBSD のソースの中で修正されたファイルの $FreeBSD$ リビジョン番号です。 Path Revision Branch - ------------------------------------------------------------------------- src/sys/conf/newvers.sh RELENG_4_4 1.44.2.17.2.5 RELENG_4_3 1.44.2.14.2.14 src/sys/kern/kern_exec.c RELENG_4 1.107.2.13 RELENG_4_4 1.107.2.8.2.1 RELENG_4_3 1.107.2.5.2.2 src/sys/kern/sys_process.c RELENG_4 1.51.2.3 RELENG_4_4 1.51.2.1.4.1 RELENG_4_3 1.51.2.1.2.1 src/sys/miscfs/procfs/procfs.h RELENG_4 1.32.2.3 RELENG_4_4 1.32.2.2.2.1 RELENG_4_3 1.32.2.1.2.2 src/sys/miscfs/procfs/procfs_ctl.c RELENG_4 1.20.2.2 RELENG_4_4 1.20.2.1.4.1 RELENG_4_3 1.20.2.1.2.1 src/sys/miscfs/procfs/procfs_dbregs.c RELENG_4 1.4.2.3 RELENG_4_4 1.4.2.2.2.1 RELENG_4_3 1.4.2.1.2.1 src/sys/miscfs/procfs/procfs_fpregs.c RELENG_4 1.11.2.3 RELENG_4_4 1.11.2.2.2.1 RELENG_4_3 1.11.2.1.2.1 src/sys/miscfs/procfs/procfs_mem.c RELENG_4 1.46.2.3 RELENG_4_4 1.46.2.2.2.1 RELENG_4_3 1.46.2.1.2.2 src/sys/miscfs/procfs/procfs_regs.c RELENG_4 1.10.2.3 RELENG_4_4 1.10.2.2.2.1 RELENG_4_3 1.10.2.1.2.1 src/sys/miscfs/procfs/procfs_status.c RELENG_4 1.20.2.4 RELENG_4_4 1.20.2.3.4.1 RELENG_4_3 1.20.2.3.2.1 src/sys/miscfs/procfs/procfs_vnops.c RELENG_4 1.76.2.7 RELENG_4_4 1.76.2.5.2.1 RELENG_4_3 1.76.2.3.2.2 src/sys/sys/proc.h RELENG_4 1.99.2.6 RELENG_4_4 1.99.2.5.4.1 RELENG_4_3 1.99.2.5.2.1 - ------------------------------------------------------------------------- VII. 参考文献 - References