FreeBSD-SA-06:09.openssh "Remote denial of service in OpenSSH"

The FreeBSD Project よりセキュリティ勧告が出ました。

セキュリティ勧告は ftp://ftp.freebsd.org/pub/FreeBSD/CERT/advisories/FreeBSD-SA-06:09.openssh.asc にあります。
以下は上記のセキュリティ勧告の一部です。ただし品質は保証致しません。

0. 改訂履歴 - Revision History

v1.0 2006-03-01
Initial release.
v1.1 2006-03-01
Corrected workaround instructions.

I. 背景 - Background

penSSH is an implementation of the SSH protocol suite, providing an encrypted, authenticated transport for a variety of services, including remote shell access.
Privilege separation is a mechanism used by OpenSSH to protect itself against possible future vulnerabilities. It works by splitting the server process in two: the child process drops its privileges and carries on the conversation with the client, while the parent retains its privileges, monitors the child, and performs privileged operations on behalf of the child when it is satisified that everything is in order. Privilege separation is enabled by default in FreeBSD.
OpenPAM is an implementation of the PAM framework, which allows the use of loadable modules to implement user authentication and session management in a manner defined by the administrator. It is used by OpenSSH and numerous other applications in FreeBSD to provide a consistent and configurable authentication system.

II. 問題の詳細 - Problem Description

Because OpenSSH and OpenPAM have conflicting designs (one is event-driven while the other is callback-driven), it is necessary for OpenSSH to fork a child process to handle calls to the PAM framework. However, if the unprivileged child terminates while PAM authentication is under way, the parent process incorrectly believes that the PAM child also terminated. The parent process then terminates, and the PAM child is left behind.
Due to the way OpenSSH performs internal accounting, these orphaned PAM children are counted as pending connections by the master OpenSSH server process. Once a certain number of orphans has accumulated, the master decides that it is overloaded and stops accepting client connections.

III. 影響範囲 - Impact

By repeatedly connecting to a vulnerable server, waiting for a password prompt, and closing the connection, an attacker can cause OpenSSH to stop accepting client connections until the system restarts or an administrator manually kills the orphaned PAM processes.

IV. 回避方法 - Workaround

The following command will show a list of orphaned PAM processes:

# pgrep -lf 'sshd.*\[pam\]'

The following command will kill orphaned PAM processes:

# pkill -f 'sshd.*\[pam\]'

To prevent OpenSSH from leaving orphaned PAM processes behind, perform one of the following:
1) Disable PAM authentication in OpenSSH. Users will still be able to log in using their Unix password, OPIE or SSH keys.
To do this, execute the following commands as root:

# echo 'UsePAM no' >>/etc/ssh/sshd_config
# /etc/rc.d/sshd restart

2) If disabling PAM is not an option - if, for instance, you use RADIUS authentication, or store user passwords in an SQL database - you may instead disable privilege separation. However, this may leave OpenSSH vulnerable to hitherto unknown bugs, and should be considered a last resort.
To do this, execute the following commands as root:

# echo 'UsePrivilegeSeparation no' >>/etc/ssh/sshd_config
# /etc/rc.d/sshd restart