首页 -> 安全研究

安全研究

绿盟月刊
绿盟安全月刊->第10期->最新漏洞
期刊号: 类型: 关键词:
OpenSSH UseLogin 参数远程漏洞

作者:Markus Friedl
日期:2000-06-14


受影响的系统:  
所有打开了"UseLogin"开关并且版本低于 2.1.1的OpenSSH
描述:
--------------------------------------------------------------------------------


OpenSSH缺省安装时并不打开"UseLogin"开关,因此缺省并不存在安全问题。
但是如果"UseLogin"开关被打开,那么所有低于2.1.1的OpenSSH都可能被
用来远程获取root权限。

如果"UseLogin"开关被使能,sshd不会自己将当前uid切换到登录的用户的uid.
而是使用login(1)程序来完成这个工作。如果用户指定一个命令来执行,login
将不能正确处理,既然sshd没有正确丢弃root权限,因此这个命令就将以sshd当
前运行的权限来执行,通常是root权限。

<* 来源: Markus Friedl <markus.friedl@INFORMATIK.UNI-ERLANGEN.DE> *>



--------------------------------------------------------------------------------
建议:
更新到OpenSSH 2.1.1,可以在www.openssh.com下载。

临时解决方法:

关闭UseLogin开关,可以在/etc/sshd_config中做如下设置:

UseLogin no

也可以使用下面的补丁程序,重新编译OpenSSH:

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. */

版权所有,未经许可,不得转载