安全研究

安全漏洞
PAM Unix_Chkpwd非授权访问漏洞

发布日期:2005-10-27
更新日期:2005-10-28

受影响系统:
RedHat Enterprise Linux WS 4
RedHat Enterprise Linux ES 4
RedHat Enterprise Linux Desktop 4
RedHat Enterprise Linux AS 4
RedHat Fedora Core 3
Linux-PAM Linux-PAM 0.77
描述:
BUGTRAQ  ID: 15217
CVE(CAN) ID: CVE-2005-2977

PAM(可插拔认证模块)系统安全工具允许系统管理员无需重新编译处理认证的程序便可设置认证策略。

如果启用了SELinux的话,PAM的unix_chkpwd帮助程序验证用户口令的方式存在漏洞,成功利用这个漏洞的攻击者可能猜到其他用户的口令,获得非授权访问。

在通常的环境下,本地非root用户无法通过unix_chkpwd命令验证其他本地用户的口令,但应用补丁添加了SELinux功能,导致本地用户可以对其他本地用户帐号暴力猜测口令:

在SELinux补丁中:

        /*
-        * determine the current user's name is
+        * determine the current user's name is.
+        * On a SELinux enabled system, policy will prevent third
parties from using
+        * unix_chkpwd as a password guesser.  Leaving the existing
check prevents
+        * su from working,  Since the current uid is the users and the
password is
+        * for root.
         */
-       user = getuidname(getuid());
-       if (argc == 2) {
-           /* if the caller specifies the username, verify that user
-              matches it */
-           if (strcmp(user, argv[1])) {
-               force_failure = 1;
-           }
+       if (SELINUX_ENABLED) {
+         user=argv[1];
+       }
+       else {
+         user = getuidname(getuid());
+         /* if the caller specifies the username, verify that user
+            matches it */
+         if (strcmp(user, argv[1])) {
+           return PAM_AUTH_ERR;
+         }
+       }

可见如果将SELinux设置为permissive模式的话可以正常运行unix_chkpwd,但即使设置为enforcing模式仍可运行。

<*来源:RedHat
  
  链接:http://lwn.net/Alerts/157169/?format=printable
*>

测试方法:

警 告

以下程序(方法)可能带有攻击性,仅供安全研究与教学之用。使用者风险自负!

$ echo -n <root password> | /sbin/unix_chkpwd root nonull && echo OK

建议:
厂商补丁:

RedHat
------
RedHat已经为此发布了一个安全公告(RHSA-2005:805-01)以及相应补丁:
RHSA-2005:805-01:Low: pam security update
链接:http://lwn.net/Alerts/157169/?format=printable

浏览次数:4984
严重程度:0(网友投票)
本安全漏洞由绿盟科技翻译整理,版权所有,未经许可,不得转载
绿盟科技给您安全的保障