From: Karel Zak Date: Thu, 8 Mar 2007 21:42:50 +0000 (+0100) Subject: login: omits PAM account validation when auth is skipped (CVE-2006-7108) X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=987195ce415a45d0ea98955019634bf2f179ffb1;p=util-linux login: omits PAM account validation when auth is skipped (CVE-2006-7108) The login omits pam_acct_mgmt & chauth_tok when authentication is skipped. Authentication may be skipped, for example, during krlogin because Kerberos already took care of it. The problem with skipping pam_acct_mgmt is that it allows users to use the system when maybe they should not be allowed, such that if they have a Kerberos ticket, the other checks do not apply. If a user had to use password authentication, pam_acct_mgmt may reject the user for several reasons: not allowed to use the system at this time, not allowed to use this system, user's account has been disabled, etc. Why should these tests be skipped just because the user has a ticket? Same with pam_chauthtok: the user may have a valid ticket, but if their password has expired, they need to enter a new one right now. Signed-off-by: Karel Zak --- diff --git a/login-utils/login.c b/login-utils/login.c index 3948cb7d..1715015d 100644 --- a/login-utils/login.c +++ b/login-utils/login.c @@ -582,16 +582,22 @@ main(int argc, char **argv) pam_end(pamh, retcode); exit(0); } + } - retcode = pam_acct_mgmt(pamh, 0); - - if(retcode == PAM_NEW_AUTHTOK_REQD) { - retcode = pam_chauthtok(pamh, PAM_CHANGE_EXPIRED_AUTHTOK); - } + /* + * Authentication may be skipped (for example, during krlogin, rlogin, etc...), + * but it doesn't mean that we can skip other account checks. The account + * could be disabled or password expired (althought kerberos ticket is valid). + * -- kzak@redhat.com (22-Feb-2006) + */ + retcode = pam_acct_mgmt(pamh, 0); - PAM_FAIL_CHECK; + if(retcode == PAM_NEW_AUTHTOK_REQD) { + retcode = pam_chauthtok(pamh, PAM_CHANGE_EXPIRED_AUTHTOK); } + PAM_FAIL_CHECK; + /* * Grab the user information out of the password file for future usage * First get the username that we are actually using, though.