============================================================================= FreeBSD-SA-01:42 Security Advisory FreeBSD, Inc. トピック: exec 中のシグナルハンドリングによりローカルから root 権限が奪取される(改訂版) 分類: core モジュール: kernel 告知日: 2001-07-10 改訂日: 2001-08-06 クレジット: Georgi Guninski 影響範囲: リリースされている全てのバージョンの FreeBSD 4.x 修正日以前の FreeBSD 4.3-STABLE 修正日: 2001-07-09 FreeBSD 固有: Yes 0. 改訂履歴 - Revision History 2001-07-10 v1.0 初版 2001-08-06 v1.1 バイナリアップグレードパッケージが利用可能になりました I. 背景 - Background When a process forks, it inherits the parent's signals. When the process execs, the kernel clears the signal handlers because they are not valid in the new address space. プロセスが fork するとき、子プロセスは親プロセスのシグナルを継承する。 プロセスが exec するときには、シグナルハンドラは新しいアドレス空間では 有効でないため、カーネルはそれをクリアする。 II. 問題の詳細 - Problem Description A flaw exists in FreeBSD signal handler clearing that would allow for some signal handlers to remain in effect after the exec. Most of the signals were cleared, but some signal hanlders were not. This allowed an attacker to execute arbitrary code in the context of a setuid binary. FreeBSD のシグナルハンドラのクリアには、exec 後にもいくつかのシグナル ハンドラの効果を残してしまう不備がある。ほとんどのシグナルはクリア されるが、クリアされないシグナルハンドラもある。これは、攻撃者が setuid されたバイナリのコンテキストで任意のコードを実行することを許して しまう。 All versions of 4.x prior to the correction date including and 4.3-RELEASE are vulnerable to this problem. The problem has been corrected by copying the inherited signal handlers and resetting the signals instead of sharing the signal handlers. 4.3-RELEASE を含む、修正日以前の全てのバージョンの 4.x は、この問題に よる脆弱性を含んでいる。この問題は、継承されたシグナルハンドラを コピーし、シグナルハンドラを共有する代わりにシグナルをリセット することで修正されている。 III. 影響範囲 - Impact Local users may be able to gain increased privileges on the local system. ローカルユーザは、ローカルシステム上で権限を昇格できる。 IV. 回避方法 - Workaround 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.3-STABLE after the correction date. 1) 脆弱性のある FreeBSD システムを修正日以降の 4.3-STABLE に更新する。 2) To patch your present system: download the relevant patch from the below location, and execute the following commands as root: 2) 現在のシステムにパッチをあてる: 以下の場所から適切なパッチをダウン ロードし、root で以下のコマンドを実行する: [FreeBSD 4.1, 4.2, and 4.3 base systems] [FreeBSD 4.1、4.2、4.3 ベースのシステム] This patch has been verified to apply to FreeBSD 4.1, 4.2, and 4.3 only. It may or may not apply to older releases. このパッチは FreeBSD 4.1、4.2、4.3 のみで適用を確認している。これより古い リリースへの適用は不明である。 # fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-01:42/signal-4.3.patch # fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-01:42/signal-4.3.patch.asc Verify the detached PGP signature using your PGP utility. PGP ユーティリティを使って PGP シグネチャを確認する。 # cd /usr/src/sys/kern # patch -p < /path/to/patch [ Recompile your kernel as described in http://www.freebsd.org/handbook/kernelconfig.html and reboot the system ] [ http://www.freebsd.org/handbook/kernelconfig.html の内容に従って カーネルを再コンパイルし、システムをリブートする ] 3) FreeBSD 4.3-RELEASE systems: 3) FreeBSD 4.3-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.3-RELEASE systems only, and is intended for use on systems for which source patching is not practical or convenient. バイナリアップグレードの処理のテストとフィードバックをしてくれる ユーザのため、実験的なアップグレードパッケージが利用可能である。この パッケージは、FreeBSD 4.3-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. もしアップグレードパッケージを利用するなら、将来の勧告の処理を改良 できるように、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. インストール中に、パッケージによって置き換えられるファイルの バックアップコピーが作成される。これらのバックアップコピーは、 システムをパッチを当てる前の状態に戻すとき、パッケージを削除した あとに再インストールできる。 # fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/packages/SA-01:42/security-patch-signal-01.42.tgz # fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/packages/SA-01:42/security-patch-signal-01.42.tgz.asc Verify the detached PGP signature using your PGP utility. PGP ユーティリティを使って PGP シグネチャを確認する。 # pkg_add security-patch-signal-01.42.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: 新しいカーネルは、デフォルトのカーネル名(``/kernl'')との衝突を避ける ため、/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. そして、新しいカーネルをロードするためにシステムを再起動する。 古いカーネルはまだ利用可能なので、問題があった場合にはブートローダ から手動でロードすることができる。