FreeBSD セキュリティ勧告 日本語版 ============================================================================= FreeBSD-SA-01:55 (2001-08-21) * procfs vulnerability leaks set[ug]id process memory ============================================================================= このメールは, announce-jp に流れた Subject: ANNOUNCE: FreeBSD Security Advisory FreeBSD-SA-01:55.procfs From: FreeBSD Security Advisories Date: Tue, 21 Aug 2001 13:39:32 -0700 (PDT) Message-Id: <200108212039.f7LKdWe21726@freefall.freebsd.org> X-Sequence: announce-jp 805 を日本語訳したものです. 原文は PGP 署名されていますが, この日本語訳は PGP 署名されていません. 修正パッチ等の内容が改ざんされていないことを確認するために PGP 署名の チェックを行なうには, 原文を参照してください. 日本語訳および, ミラーサイト利用の詳細については, 文末の「A. FreeBSD セキュリティ勧告 日本語版について」をご覧ください. [翻訳者: 佐藤 広生 ] --(ここから) ============================================================================= FreeBSD-SA-01:55 Security Advisory FreeBSD, Inc. トピック: procfs における setuid/setgid プロセスメモリ空間の情報漏洩の危険性 (procfs vulnerability leaks set[ug]id process memory) 分類: core モジュール: procfs 告知日: 2001-08-21 クレジット: Joost Pol 影響範囲: 修正日以前の FreeBSD 4.x および 4.3-STABLE 修正日: 2001-08-12 07:29 PDT (4.3-STABLE) 2001-08-13 12:45 PDT (RELENG_4_3) FreeBSD に固有か: Yes I. 背景 - Background procfs is the process filesystem, which presents a filesystem interface to the system process table, together with associated data. procfs provides access to the memory space of processes via the synthetic /proc//mem file, subject to access control checks. procfs とは, システムのプロセステーブルおよび, それに関連するデータへの ファイルシステムインターフェイスを提供する, プロセスファイルシステムです. procfs ではプロセスのメモリ空間へのアクセス手段および, その際の アクセス制御チェックを /proc//mem ファイルを用いることで実現しています. linprocfs is an implementation of procfs which implements a Linux-style procfs, for use with Linux binaries so they can obtain access to exported kernel data. It uses procfs to provide the /proc//mem file. linprocfs とは Linux 風の procfs を実現するための procfs 実装の一つで, Linux バイナリから export されたカーネルデータにアクセスできるように するためのものです. これは /proc//mem を提供するために procfs を使っています. II. 問題の詳細 - Problem Description Prior to the migration of system monitoring utilities (such as ps(8)) to use the sysctl(8) management interface, these utilities formerly used procfs and direct kernel memory access to extract process information, and they ran with the setgid kmem privilege to allow direct kernel memory access. The procfs code checks for gid kmem privilege when granting access to the /proc//mem file -- however, the code which is used to allow read-only access via the kmem group was incorrect, and inappropriately granted read access to the caller as long as they already had an open file descriptor for the procfs mem file. (ps(8) のような) システムのモニタリングユーティリティは, 管理情報へのアクセスに sysctl(8) を利用するように変更されるまで, procfs を用いてカーネルのメモリ空間から直接, プロセス情報を 抽出していました. また, そのようなユーティリティは カーネルのメモリ空間へ直接アクセスできるようにするため, kmem グループで setgid されていました. procfs のコードは /proc//mem ファイルのアクセスに対して kmem グループ権限を持っていることをチェックするようになっています. しかし kmem グループ権限で読み出し専用アクセスを許可するコードに 誤りがあり, open された procfs mem ファイルのファイル記述子を 持っていれば, (訳注: kmem グループ権限を持っていないプロセスからで あっても) 読み出しアクセスを不適切に許可してしまいます. The result of this problem is that if a process initially has debugging rights to a second process, it may retain access to the target process' memory space, even if the target process has upgraded privilege by virtue of performing an execve() call on a setuid or setgid process. This vulnerability can lead to the leaking of sensitive information from such processes, which could be used as the basis for additional attacks, resulting in escalation of attacker privilege on the system. この問題により, 次のような状況が発生します. あるプロセスが デバッグ目的でもう一つの新しいプロセスを生成するような場合を 考えてみてください. デバッグ対象プロセスが setuid/setgid されていれば, そのプロセスは execve() システムコールによって高い権限を得ます. しかし, デバッグ対象プロセスのメモリ空間へアクセスは, このプロセスが 高い権限を得た後も可能なままになります. このセキュリティ上の弱点は, そのシステム上で高い権限を得るための二次的な攻撃を可能にするような, 重要な情報の漏洩の原因となる可能性があります. The linprocfs filesystem is also vulnerable to the problem if procfs support is available in the kernel (statically compiled in, or dynamically loaded as a module). If procfs support is not available then linprocfs is not vulnerable to this problem. (静的にコンパイルするか, モジュールとして動的にロードすることで) カーネルが procfs に対応していれば, linprocfs ファイルシステムも同様の弱点が存在します. もし procfs が有効化されていなければ, linprocfs にこの問題による セキュリティ上の弱点はありません. All released versions of FreeBSD 4.x including FreeBSD 4.3-RELEASE are vulnerable to this problem if the procfs filesystem is in use. It was corrected prior to the (forthcoming) release of FreeBSD 4.4-RELEASE. procfs ファイルシステムを有効化している FreeBSD 4.3-RELEASE および FreeBSD 4.x のすべてのリリースが, この問題の影響を受けます. この問題は, 公開予定の FreeBSD 4.4-RELEASE のリリース前に修正されました. III. 影響範囲 - Impact Attackers may be able to extract sensitive system information, such as password hashes from the /etc/master.passwd file, from setuid or setgid processes, such as su(1). This information could be used by attackers to escalate their privileges, possibly yielding root privileges on the local system. 攻撃者は su(1) などの setuid もしくは setgid されたプロセスを利用して, /etc/master.passwd ファイルにあるパスワードハッシュといった 重要なシステム情報を不正に得ることができる可能性があります. また攻撃者がこの情報を使ってさらに高い権限, たとえば ローカルシステム上の root 権限を得ることができる危険性があります. Because this attack may only be used on processes that initially are "debuggable" by the attacking process, this attack is limited to executed processes which gain privilege by virtue of being setuid or setgid, and so it cannot be used against other processes which are already running with privilege such as already-running daemons containing sensitive system information. この攻撃は, 攻撃用プロセスによって「生成時からデバッグ可能に なっている」プロセスを使うことによってのみ実現可能なため, 影響範囲は setuid や setgid を利用して高い権限を得るプロセスに 制限されます. 重要なシステム情報を保持した実行状態にあるデーモンなど, 高い権限を持つ既存のプロセスに対する危険性はありません. IV. 回避方法 - Workaround To work around the problem, perform the following steps as root: この問題を回避するには, root 権限で以下の手順に従ってください. Unmount all instances of the procfs and linprocfs filesystems using the unmount(8) command: umount(8) コマンドを用いて, procfs および linprocfs ファイルシステムを すべてアンマウントします. # umount -f -a -t procfs # umount -f -a -t linprocfs 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 proc /compat/linux/proc linprocfs rw 0 0 V. 解決策 - Solution 1) Upgrade your vulnerable system to 4.3-STABLE or the RELENG_4_3 security branch, dated after the respective correction dates. 1) 弱点を持った FreeBSD システムを修正日以降の FreeBSD 4.3-STABLE もしくは RELENG_4_3 セキュリティブランチにアップグレードする. 2) To patch your present system: download the relevant patch from the below location, and execute the following commands as root: 2) 現在のシステムに修正パッチを適用する. 以下の場所から修正パッチを ダウンロードし, root 権限で次のコマンドを実行してください. # fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-01:55/procfs.patch # fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-01:55/procfs.patch.asc PGP ユーティリティを使って PGP 署名を確認します. This patch has been verified to apply to FreeBSD 4.3-RELEASE and 4.2-RELEASE (users of 4.2-RELEASE should already have the patch from FreeBSD SA-00:77.procfs installed). It may or may not apply to older, unsupported releases of FreeBSD. 以下の修正パッチは, FreeBSD 4.2-RELEASE, 4.3-RELEASE および, 修正日以前の FreeBSD 4-STABLE に対して適用可能なことが確認されているものです (ただし 4.2-RELEASE のユーザは, FreeBSD SA-00:77.procfs の修正パッチが 適用済みである必要があります). それよりも古いリリースや サポートされていない FreeBSD リリースに対しては, これらの修正パッチが 正しく適用できない可能性があります. # cd /usr/src/sys # patch -p < /path/to/patch If procfs is statically compiled into the kernel (i.e. the kernel configuration file contains the line 'options PROCFS'), then 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. By default procfs is statically compiled in the GENERIC kernel configuration. カーネルに procfs を静的にコンパイルしている (カーネルコンフィグファイルに 'options PROCFS' という行が含まれている) 場合は, http://www.freebsd.org/handbook/kernelconfig.html に記載されている 手順にしたがってカーネルを再構築・再インストールして, その後に 変更を有効化するため, システムを再起動する必要があります. デフォルトの procfs は GENERIC カーネルに静的にコンパイルされています. If procfs is dynamically loaded by KLD (use the kldstat(8) command to verify whether this is the case) and the system securelevel has not been raised to a level of 1 or higher, the system can be patched at run-time without requiring a reboot by performing the following steps after patching the source as described above: KLD モジュールを使って procfs を動的にロードして (kldstat(8) コマンドを実行することで, KLD モジュールを使っているかどうか判別できます) いて, システムのセキュアレベルが 1 以上に設定されていない場合には, 上記のようにソースに修正パッチを適用して以下の手順に従うことで, 再起動せずに稼働中のシステムを修正することが可能です. # cd /usr/src/sys/modules/procfs # make depend # make all install # umount -f -a -t procfs # kldunload procfs # kldload procfs # mount -a -t procfs 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 までご意見をお寄せください. 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:55/security-patch-procfs-01.55.tgz # fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/packages/SA-01:55/security-patch-procfs-01.55.tgz.asc PGP ユーティリティを使って PGP 署名を確認します. # pkg_add security-patch-procfs-01.55.tgz Restart your system after applying the patch. 修正パッチを適用した後, システムを再起動してください. VI. 該当する CVS リビジョン - CVS Revisions The following $FreeBSD$ CVS revisions contain the fixes for this vulnerability. The $FreeBSD$ revision of installed sources can be examined using the ident(1) command. These revision IDs are not updated by applying the patch referenced above. この問題に対する修正は, 以下の $FreeBSD$ CVS リビジョンに含まれています. インストール済みソースファイルの $FreeBSD$ リビジョン番号は ident(1) コマンドを使うことで確認できます. これらのリビジョン ID は 上記の修正パッチが適用されても更新されません. [FreeBSD 4.3-STABLE] Revision Path 1.3.2.5 src/sys/i386/linux/linprocfs/linprocfs_vnops.c 1.32.2.2 src/sys/miscfs/procfs/procfs.h 1.46.2.2 src/sys/miscfs/procfs/procfs_mem.c 1.76.2.5 src/sys/miscfs/procfs/procfs_vnops.c リビジョン番号 パス名 1.3.2.5 src/sys/i386/linux/linprocfs/linprocfs_vnops.c 1.32.2.2 src/sys/miscfs/procfs/procfs.h 1.46.2.2 src/sys/miscfs/procfs/procfs_mem.c 1.76.2.5 src/sys/miscfs/procfs/procfs_vnops.c [RELENG_4_3] Revision Path 1.3.2.3.2.1 src/sys/i386/linux/linprocfs/linprocfs_vnops.c 1.32.2.1.2.1 src/sys/miscfs/procfs/procfs.h 1.46.2.1.2.1 src/sys/miscfs/procfs/procfs_mem.c 1.76.2.3.2.1 src/sys/miscfs/procfs/procfs_vnops.c リビジョン番号 パス名 1.3.2.3.2.1 src/sys/i386/linux/linprocfs/linprocfs_vnops.c 1.32.2.1.2.1 src/sys/miscfs/procfs/procfs.h 1.46.2.1.2.1 src/sys/miscfs/procfs/procfs_mem.c 1.76.2.3.2.1 src/sys/miscfs/procfs/procfs_vnops.c A. FreeBSD セキュリティ勧告 日本語版について 日本語訳は FreeBSD 日本語ドキュメンテーションプロジェクト (doc-jp) が 参考のために提供するものです. 過去の日本語版セキュリティ勧告は http://www.FreeBSD.org/ja/security/ にまとめられています. ただし, 翻訳者および doc-jp は, その内容についていかなる保証も いたしませんのでご注意ください. 日本語訳についてのご意見, ご要望, お問い合わせ等は doc-jp@jp.FreeBSD.org までお願いします. この勧告の中で紹介されている WWW サイト http://www.FreeBSD.org/ および FTP サイト ftp://ftp.FreeBSD.org/ には, 日本のミラーサイトが存在します. ネットワークの混雑を緩和するため, まずはミラーサイトの利用を 考慮するようお願いします. 日本のミラーサイトを利用するには, http://www.FreeBSD.org/ を http://www.jp.FreeBSD.org/www.freebsd.org/ に, ftp://ftp.FreeBSD.org/ を ftp://ftp.jp.FreeBSD.org/ に, それぞれ置き換えてください. 他の地域を含む, ミラーサイトに関する詳細は, http://www.FreeBSD.org/handbook/mirror.html (英文) http://www.FreeBSD.org/ja/handbook/mirror.html (日本語訳) にまとめられています. $hrs: announce-jp/FreeBSD-SA/01:55,v 1.7 2001/12/23 14:23:56 hrs Exp $