From djm at mindrot.org Sat Jun 10 08:56:37 2000 From: djm at mindrot.org (Damien Miller) Date: Sat, 10 Jun 2000 08:56:37 +1000 (EST) Subject: OpenSSH's UseLogin option allows remote access with root privilege. (fwd) Message-ID: -- | "Bombay is 250ms from New York in the new world order" - Alan Cox | Damien Miller - http://www.mindrot.org/ | Email: djm at mindrot.org (home) -or- djm at ibs.com.au (work) ---------- Forwarded message ---------- Date: Fri, 9 Jun 2000 17:06:30 +0200 From: Markus Friedl To: BUGTRAQ at SECURITYFOCUS.COM, misc at openbsd.org, openssh-unix-dev at mindrot.org Subject: OpenSSH's UseLogin option allows remote access with root privilege. OpenSSH's UseLogin option allows remote access with root privilege. 1. Systems affected: The default installation of OpenSSH is not vulnerable, since UseLogin defaults to 'no'. However, if UseLogin is enabled, all versions of OpenSSH prior to 2.1.1 are affected. 2. Description: If the UseLogin option is enabled the OpenSSH server (sshd) does not switch to the uid of the user logging in. Instead, sshd relies on login(1) to do the job. However, if the user specifies a command for remote execution login(1) cannot be used and sshd fails to set the correct user id. The command is run with the same privilege as sshd (usually with root privilege). 3. Impact: If the administrator enables UseLogin users can get privileged access to the server running sshd. 4. Short Term Solution: Do not enable UseLogin on your machines or disable UseLogin again in /etc/sshd_config: UseLogin no 5. Solution: Upgrade to OpenSSH-2.1.1 or apply the attached patch. OpenSSH-2.1.1 is available from www.openssh.com. Appendix: 1. OpenSSH-1.2.2 --- sshd.c.orig Thu Jan 20 18:58:39 2000 +++ sshd.c Tue Jun 6 10:12:00 2000 @@ -2231,6 +2231,10 @@ struct stat st; char *argv[10]; + /* login(1) is only called if we execute the login shell */ + if (options.use_login && command != NULL) + options.use_login = 0; + f = fopen("/etc/nologin", "r"); if (f) { /* /etc/nologin exists. Print its contents and exit. */ 2. OpenSSH-1.2.3 --- sshd.c.orig Mon Mar 6 22:11:17 2000 +++ sshd.c Tue Jun 6 10:14:07 2000 @@ -2250,6 +2250,10 @@ struct stat st; char *argv[10]; + /* login(1) is only called if we execute the login shell */ + if (options.use_login && command != NULL) + options.use_login = 0; + f = fopen("/etc/nologin", "r"); if (f) { /* /etc/nologin exists. Print its contents and exit. */ 3. OpenSSH-2.1.0 --- session.c.orig Wed May 3 20:03:07 2000 +++ session.c Tue Jun 6 10:10:50 2000 @@ -744,6 +744,10 @@ struct stat st; char *argv[10]; + /* login(1) is only called if we execute the login shell */ + if (options.use_login && command != NULL) + options.use_login = 0; + f = fopen("/etc/nologin", "r"); if (f) { /* /etc/nologin exists. Print its contents and exit. */ EOF From djm at mindrot.org Sat Jun 10 09:08:03 2000 From: djm at mindrot.org (Damien Miller) Date: Sat, 10 Jun 2000 09:08:03 +1000 (EST) Subject: Portable OpenSSH 2.1.1p1 Message-ID: Announcing the availability of portable OpenSSH 2.1.1p1. This release contains the fix for the "UseLogin yes" vulnerability identified in Markus' release and several other enhancements and bugfixes. Including: - Better login code. Andre Lucas has rewritten the login code to be much more modular and extensible. In the process he has fixed the problems with Solaris utmp[x]. - Revised the entropy collection code to be faster and more reliable. - Fix for RSA host restrictions ("from=" in authorized_keys) It is recommended that all users upgrade to this version. Portable OpenSSH 2.1.1p1 is available from one of the many mirrors listed at: http://www.openssh.com/portable.html Regards, Damien Miller -- | "Bombay is 250ms from New York in the new world order" - Alan Cox | Damien Miller - http://www.mindrot.org/ | Email: djm at mindrot.org (home) -or- djm at ibs.com.au (work)