============================================================================= FreeBSD-SA-02:07 Security Advisory FreeBSD, Inc. トピック: Kerberons バージョン5 の su コマンドがユーザ認証のために getlogin システムコールを使用する (Kerberos 5 su command uses getlogin for authorization) カテゴリ: krb5, ports モジュール: crypto/heimdal/appl/su, heimdal 告知日: 2002-01-18 クレジット: Aaron 影響範囲: FreeBSD 4.4-RELEASE 修正日より前の FreeBSD 4.4-STABLE 修正日より前の Ports collection 修正日: 2002-01-15 21:52:48 UTC (RELENG_4) 2002-01-17 15:45:05 UTC (RELENG_4_4) 2002-10-31 19:58:05 UTC (heimdal port) FreeBSD 固有: NO I. 背景 - Background The getlogin and setlogin system calls are used to manage the user name associated with a login session. getlogin および setlogin システムコールは、ログインセッションと ユーザ名を関連付けるために使用します。 k5su is a Kerberos 5-enabled su program. Like su, it allows authorized users to `switch user' in order to obtain additional privileges. k5su は Kerberos 5 で使用可能な su プログラムです。su コマンドの ように、許可されたユーザが、他のユーザの権限を取得するために `別のユーザに切り替わる' ことができます。 II. 問題の詳細 - Problem Description The setlogin system call, the use of which is restricted to the superuser, is used to associate a user name with a login session. The getlogin system call is used to retrieve that user name. The setlogin system call is typically used by applications such as login and sshd. setlogin システムコールは、ログインセッションに対応するユーザ名を 結びつけます。このシステムコールは、スーパーユーザのみが呼び出せる ように制限されています。一方 getlogin システムコールは、setlogin システムコールでセッションに結びつけたユーザ名を返します。setlogin システムコールは、通常 login や sshd のようなアプリケーションが利用 します。 The k5su command included with FreeBSD, versions prior to 4.5-RELEASE, and the su command included in the heimdal port, versions prior to heimdal-0.4e_2, use the getlogin system call in order to determine whether the currently logged-in user is `root'. In some circumstances, it is possible for a non-privileged process to have `root' as the login name returned by getlogin. FreeBSD 4.5-RELEASE より前のリリースに含まれている k5su コマンド、 および heimdal(kerberos 5 の実装の一つ)の port(heimdal-0.4e_2 より前のバージョン)に含まれている su コマンドは、現在ログインして いるユーザが `root' かどうかを識別するために getlogin システムコール を使用します。しかしある種の状況下では、root 権限を持たないプロセスに 対して、getlogin システムコール が `root' というログイン名を返して しまう場合があります。 The `k5su' command may be installed as part of FreeBSD when Kerberos 5 support is requested, or it may be installed from the FreeBSD Ports Collection (ports/security/heimdal), in which case it is installed simply as `su'. Kerberos 5 のサポートをオンにした場合、`k5su' コマンドが FreeBSD の 一部としてインストールされている場合があります。また、FreeBSD Ports Collection(ports/security/heimdal)からインストールされている場合は、 `su' コマンドとしてインストールされています。 The Heimdal port is not installed by default, nor is it "part of FreeBSD" as such: it is part of the FreeBSD ports collection, which contains over 6000 third-party applications in a ready-to-install format. The ports collection shipped with FreeBSD 4.4 contains this problem since it was discovered after the release. Heimdal の port はデフォルトではインストールされていませんし、 "FreeBSD の一部" でもありません。それは 6000 以上のサードパーティ製 アプリケーションをすぐにインストールできる形式で収録した FreeBSD ports collection の一部です。FreeBSD 4.4 のリリース後にこの問題が 発見されたため、4.4 と共にリリースされた ports collection には この問題があります。 FreeBSD makes no claim about the security of these third-party applications, although an effort is underway to provide a security audit of the most security-critical ports. FreeBSD は、このようなサードパーティ製のアプリケーションのセキュリティ について、何か主張するということはありません。しかし、システムのセキュリ ティに大きな影響を与える ports に関しては、セキュリティ監査を提供するよう 努力を続けています。 III. 影響範囲 - Impact In some circumstances, process that have been started by root but have given up superuser privileges may be able to invoke `k5su' to regain superuser privileges. root 権限で起動され、その後スーパーユーザ権限を失ったプロセスが、 `k5su' コマンドを呼び出すことによって再度スーパーユーザ権限を獲得 することができる場合があります。 IV. 回避方法 - Workaround Commands to be executed as root are signified by lines starting with the `#' character. 行頭が `#' で始まる行は、そのコマンドを root 権限で実行することを 示しています。 [Kerberos 5 in the base system] [基本システムに Kerberos 5 が組み込まれている場合] (訳注: インストール時、または sysinstall コマンドで kerberos 5 の サポートを有効にした場合) Remove the set-user-ID bit from the `k5su' executable by running the following command as root: root 権限で以下のコマンドを実行し、`k5su' コマンドからセットユーザ ID ビットを除去します: # chmod u-s /usr/bin/k5su [Heimdal port] [Heimdal の port をインストールしている場合] Remove the set-user-ID bit from the `su' executable by running the following command as root: root 権限で以下のコマンドを実行し、`k5su' コマンドからセットユーザ ID ビットを除去します: # chmod u-s /usr/local/bin/su V. 解決法 - Solution [Kerberos 5 in the base system] [基本システムに Kerberos 5 が組み込まれている場合] NOTE: If the file /usr/bin/k5su does not exist on your system, Kerberos 5 is not installed and you do not need to take any action. 注意: /usr/bin/k5su コマンドが存在しない場合は、システムに Kerberos 5 が組み込まれていないため対策を行う必要はありません。 Do one of the following: 以下のいずれかを実行してください: 1) Upgrade your system to 4.4-STABLE or the RELENG_4_4 security branch, dated after the respective correction dates. 1) 修正日以降の 4.4-STABLE か RELENG_4_4 セキュリティブランチに システムをアップグレードします。 2) To patch your present system: 2) 現在のシステムにパッチを当てます: The following patch has been verified to apply to FreeBSD 4.4-RELEASE and 4.4-STABLE dated prior to the correction date. It may or may not apply to older, unsupported versions of FreeBSD. 以下のパッチは、FreeBSD 4.4-RELEASE および修正日より前の 4.4-STALBE への適用を確認しています。これより古い、サポート外のバージョンの 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:07/k5su.patch # fetch ftp://ftp.freebsd.org/pub/FreeBSD/CERT/patches/SA-02:07/k5su.patch.asc Execute the following commands as root: root 権限で以下のコマンドを実行します: # cd /usr/src # patch < /path/to/k5su.patch # cd /usr/src/kerberos5/lib # env MAKE_KERBEROS5=yes make depend # env MAKE_KERBEROS5=yes make all install # cd /usr/src/kerberos5/usr.bin/k5su # env MAKE_KERBEROS5=yes make depend # env MAKE_KERBEROS5=yes make all install [Heimdal port] [Heimdal の port をインストールしている場合] Do one of the following: 以下のいずれかを実行します: 1) Upgrade your entire ports collection and rebuild the port. 1) ports collection 全体をアップグレードし、Heimdal の port をリビルド します。 2) Deinstall the old package and install a new package dated after the correction date, obtained from the following directories: 2) 古い package を削除し、以下の場所から入手した修正日以降の新しい package をインストールします。 [i386] ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/i386/packages-4-stable/security/heimdal-0.4e_2.tgz ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/i386/packages-5-current/security/heimdal-0.4e_2.tgz [alpha] Packages are not automatically generated for the alpha architecture at this time due to lack of build resources. package をビルドするためのリソースが不足しているため、現時点では alpha アーキテクチャ用の package の自動生成は行っていません。 3) Download a new port skeleton for the heimdal port from: 3) 以下の場所から heimdal の port 用の新しい port スケルトンをダウンロード します: http://www.freebsd.org/ports/ and use it to rebuild the port. そして、これを使って port をリビルドします。 4) Use the portcheckout utility to automate option (3) above. The portcheckout port is available in /usr/ports/devel/portcheckout or the package can be obtained from: 4) 上記の選択肢 (3) の作業を自動化するため、portcheckout ユーティリティを 使用します。portcheckout の port は /usr/ports/devel/portcheckout で利用 できるほか、以下の場所から package を入手することもできます: ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/i386/packages-4-stable/devel/portcheckout-2.0.tgz ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/i386/packages-5-current/devel/portcheckout-2.0.tgz VI. 修正の詳細 - Correction details The following list contains the revision numbers of each file that was corrected in the FreeBSD ports collection. 以下のリストは、FreeBSD ports collection の中で修正されたファイルの リビジョン番号を示しています。 [Kerberos 5 in the base system] Path Revision Branch - ------------------------------------------------------------------------- src/crypto/heimdal/appl/su/su.c HEAD 1.1.1.4 RELENG_4 1.1.1.1.2.2 RELENG_4_4 1.1.1.1.2.1.4.1 RELENG_4_3 1.1.1.1.2.1.2.1 - ------------------------------------------------------------------------- [Heimdal port] Path Revision - ------------------------------------------------------------------------- ports/security/heimdal/Makefile 1.46 ports/security/heimdal/patch-appl::su::su.c 1.1 - -------------------------------------------------------------------------