============================================================================= FreeBSD-SA-02:13 Security Advisory FreeBSD, Inc. トピック: OpenSSH の攻撃可能な off-by-one バグ問題 (OpenSSH contains exploitable off-by-one bug) カテゴリ: core, ports モジュール: openssh, ports_openssh, openssh-portable 告知日: 2002-03-07 クレジット: Joost Pol 影響範囲: FreeBSD 4.4-RELEASE, 4.5-RELEASE 修正日より前の FreeBSD 4.5-STABLE openssh-3.0.2_1 よりの前 openssh port openssh-portable-3.0.2p1_1 より前の openssh-portable port 修正日: 2002-03-06 13:57:54 UTC (RELENG_4) 2002-03-07 14:40:56 UTC (RELENG_4_5) 2002-03-07 14:40:07 UTC (RELENG_4_4) 2002-03-06 13:53:38 UTC (ports/security/openssh) 2002-03-06 13:53:39 UTC (ports/security/openssh-portable) CVE: CAN-2002-0083 FreeBSD 固有: NO I. 背景 - Background OpenSSH is a free version of the SSH protocol suite of network connectivity tools. OpenSSH encrypts all traffic (including passwords) to effectively eliminate eavesdropping, connection hijacking, and other network-level attacks. Additionally, OpenSSH provides a myriad of secure tunneling capabilities, as well as a variety of authentication methods. `ssh' is the client application, while `sshd' is the server. OpenSSH はネットワーク接続ツールである SSH プロトコルスイートの フリーな実装です。OpenSSH は全てのトラフィック(これにはパスワードの ような重要な情報も含まれています)を暗号化し、盗聴やコネクションの ハイジャック、その他ネットワークレベルの攻撃を効果的に防止します。 さらに OpenSSH は、複数の認証方式のほか、多数の安全なトンネリング 機能も提供します。`ssh' はクライアント側のアプリケーション、`sshd' はサーバです。 II. 問題の詳細 - Problem Description OpenSSH multiplexes `channels' over a single TCP connection in order to implement X11, TCP, and agent forwarding. An off-by-one error in the code which manages channels can result in a reference to memory beyond that allocated for channels. A malicious client or server may be able to influence the contents of the memory so referenced. OpenSSH は、X11 や TCP、エージェントなどのデータの同時転送を実現する ため、一つの TCP コネクション上に複数の `チャネル' を多重化させています。 このチャネルを管理しているコードに off-by-one エラー(訳注: 割り当て られたメモリサイズに対して、1バイトだけ大きな領域にデータを格納して しまうこと)があり、メモリへの参照がチャネル用に割り当てられた領域を 越えてしまう場合があります。悪意のあるクライアントやサーバは、そのように して参照されたメモリの内容を書き換えることができてしまいます。 III. 影響範囲 - Impact An authorized remote user (i.e. a user that can successfully authenticate on the target system) may be able to cause sshd to execute arbitrary code with superuser privileges. 認証済みのリモートユーザ(目標のシステムの認証に成功できるユーザ) が sshd を利用してスーパーユーザ権限で任意のコードを実行できる 可能性があります。 A malicious server may be able to cause a connecting ssh client to execute arbitrary code with the privileges of the client user. また、悪意のあるサーバが、接続してきた ssh クライアントのホスト上で 任意のコードを実行させることができる可能性があります。このコードは ssh クライアントを実行しているユーザの権限で実行されます。 IV. 回避方法 - Workaround Do one of the following: 以下のいずれかを実行してください: 1) The FreeBSD malloc implementation can be configured to overwrite or `junk' memory that is returned to the malloc arena. Due to the details of exploiting this bug, configuring malloc to junk memory will thwart the attack. 1) FreeBSD の malloc の実装は、malloc の管理領域に返されたメモリの内容を 次回そのまま上書きして利用するか、'破棄する'(訳注: malloc() や free() 等でメモリの割り当て・開放をする際に、内容を 0xd0 に初期化すること)か を設定することができます。このバグを利用した攻撃手法の性質(訳注: ヒープ領域のオーバーフローを利用している)により、メモリ内容を破棄する ように malloc を設定することで、攻撃を妨害することが可能です。 To configure a FreeBSD system to junk memory, execute the following commands as root: メモリ内容を破棄するように FreeBSD システムを設定するには、root 権限で 以下のコマンドを実行します: # ln -fs J /etc/malloc.conf Note that this option will degrade system performance. See the malloc(3) man page for full details on malloc options. このオプションはシステムのパフォーマンスをを低下させることに注意 してください。malloc のオプションの完全な詳細については malloc(3) の man ページを参照してください。 2) Disable the base system sshd by executing the following command as root: 2) root 権限で以下のコマンドを実行し、基本システムの sshd を無効にする: # kill `cat /var/run/sshd.pid` Be sure that sshd is not restarted when the system is restarted by adding the following line to the end of /etc/rc.conf: システムが再起動した際に sshd が起動しないよう、忘れずに /etc/rc.conf に以下の行を追加してください: sshd_enable="NO" AND Deinstall the openssh or openssh-portable ports if you have one of them installed. さらに、openssh や openssh-portable の ports をインストールしている 場合はこれらの port も削除します。 V. 解決方法 - Solution Do one of the following: 以下のいずれかを実行してください: [For OpenSSH included in the base system] [基本システムに含まれる OpenSSH を使用している場合] 1) Upgrade the vulnerable system to 4.4-RELEASEp9, 4.5-RELEASEp2, or 4.5-STABLE after the correction date and rebuild. 1) 脆弱性のあるシステムを 4.4-RELEASEp9、4.5-RELEASEp2、修正日以降の 4.5-STABLE のいずれかにアップグレードして再構築する。 2) FreeBSD 4.x systems prior to the correction date: 2) 修正日より前の FreeBSD 4.x システムの場合: The following patch has been verified to apply to FreeBSD 4.4-RELEASE, 4.5-RELEASE, and 4.5-STABLE dated prior to the correction date. It may or may not apply to older, unsupported versions of FreeBSD. 以下のパッチは FreeBSD 4.4-RELEASE、4.5-RELEASE および修正日より前の 4.5-STABLE への適用を確認済みです。これより古いサポート外のバージョン の 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:13/openssh.patch # fetch ftp://ftp.FreeBSD.org/pub/FreeBSD/CERT/patches/SA-02:13/openssh.patch.asc Execute the following commands as root: root 権限で以下のコマンドを実行します: # cd /usr/src # patch < /path/to/sshd.patch # cd /usr/src/secure/lib/libssh # make depend && make all # cd /usr/src/secure/usr.sbin/sshd # make depend && make all install # cd /usr/src/secure/usr.bin/ssh # make depend && make all install [For the OpenSSH ports] [OpenSSH の ports を使用している場合] One of the following: 以下のいずれかを実行してください: 1) Upgrade your entire ports collection and rebuild the OpenSSH port. 1) ports collection 全体をアップグレードし、OpenSSH の port をリビルド します。 2) Deinstall the old package and install a new package obtained from the following directory: 2) 古い package を削除し、以下の場所から入手した新しい package を インストールします: [i386] ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/i386/packages-4-stable/security/ [other platforms] Packages are not automatically generated for other platforms at this time due to lack of build resources. package をビルドするリソースが不足しているため、現時点では i386 以外の プラットホーム用の package は自動生成されていません。 3) Download a new port skeleton for the openssh or openssh-portable port from: 3) 以下の場所から openssh や openssh-portable 用の新しい 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/Latest/portcheckout.tgz ftp://ftp.FreeBSD.org/pub/FreeBSD/ports/i386/packages-5-current/Latest/portcheckout.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 の中で修正されたファイルの リビジョン番号です。 Path Revision Branch - ------------------------------------------------------------------------- [Base system] src/crypto/openssh/channels.c HEAD 1.8 RELENG_4 1.1.1.1.2.6 RELENG_4_5 1.1.1.1.2.5.2.1 RELENG_4_4 1.1.1.1.2.4.4.1 src/crypto/openssh/version.h HEAD 1.10 RELENG_4 1.1.1.1.2.8 RELENG_4_5 1.1.1.1.2.7.2.1 RELENG_4_4 1.1.1.1.2.5.2.2 src/sys/conf/newvers.sh RELENG_4_5 1.44.2.20.2.3 RELENG_4_4 1.44.2.17.2.8 [Ports] ports/security/openssh/Makefile 1.81 ports/security/openssh/files/patch-channels.c 1.1 ports/security/openssh-portable/Makefile 1.21 ports/security/openssh-portable/files/patch-channels.c 1.1 - ------------------------------------------------------------------------- Branch Version string - ------------------------------------------------------------------------- HEAD OpenSSH_2.9 FreeBSD localisations 20020307 RELENG_4 OpenSSH_2.9 FreeBSD localisations 20020307 RELENG_4_5 OpenSSH_2.9 FreeBSD localisations 20020307 RELENG_4_4 OpenSSH_2.3.0 FreeBSD localisations 20020307 - ------------------------------------------------------------------------- To view the version string of the OpenSSH server, execute the following command: OpenSSH サーバのバージョン文字列を表示するには、以下のコマンドを実行します: % /usr/sbin/sshd -\? The version string is also displayed when a client connects to the server. バージョン文字列は、クライアントがサーバに接続した際にも表示されます。 To view the version string of the OpenSSH client, execute the following command: OpenSSH クライアントのバージョン文字列を表示するには、以下のコマンドを実行 します: % /usr/bin/ssh -V VII. 参考資料 - References The Common Vulnerabilities and Exposures project (cve.mitre.org) has assigned the name CAN-2002-0083 to this issue. CVE プロジェクト(cve.mitre.org) は、この脆弱性に CAN-2002-0083 という 脆弱性番号を割り当てました。