Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 169919 - sys-libs/pam: allow access to user authenticated by LDAP but disallowed to login
Summary: sys-libs/pam: allow access to user authenticated by LDAP but disallowed to login
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Gentoo Security
URL:
Whiteboard: B4 [upstream] Falco
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-08 10:19 UTC by Robert Wolf
Modified: 2007-05-20 21:33 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Email for pam-list mailing list (email-bug.txt,7.97 KB, text/plain)
2007-03-08 10:21 UTC, Robert Wolf
no flags Details
Debian patch to PAM-Linux for Debian 4.0 etch (pam-patch.debian.txt,5.63 KB, patch)
2007-04-25 09:53 UTC, Robert Wolf
no flags Details | Diff
My patch to resolve pam_unix account bug (pam-patch.wolf.txt,689 bytes, patch)
2007-04-25 09:55 UTC, Robert Wolf
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Wolf 2007-03-08 10:19:31 UTC
When system configured to use LDAP authentication with login limit for users in groupDN, pam_unix allow access to user, which has no record in shadow [broken_shadow IS NOT used] and user must not be allowed to login.

I wrote a long letter and I wanted to send it into pam-list mailing list, but my email never appeared in list. See the text in attachment.

I'm not sure, if this is a feature or bug, but it doesn't work as I expect. The examples are for Debian distro, but the "bug" is also in Gentoo. If you need more information or want to discuss this, send me an email or we can talk on IRC (send request by email).

Reproducible: Always

Steps to Reproduce:
1. configure system to use LDAP in nss
2. create posixAccounts TESTER-A and TESTER-B and posixGroup and groupOfUniqueNames sshloginusers, include only TESTER-A (as DN) in uniqueMember
3. configure PAM for SSH to authenticate in LDAP
4. configure PAM LDAP to allow login only users from group cn=sshloginusers
5. try to login user TESTER-A and user TESTER-B.

Actual Results:  
TESTER-A should login - OK
TESTER-B get error message "You must be a uniqueMember of LOGIN-ALLOWED-GROUP-DN to login." but login is allowed

Expected Results:  
I expect system disables user TESTER-B to login
Comment 1 Robert Wolf 2007-03-08 10:21:24 UTC
Created attachment 112554 [details]
Email for pam-list mailing list

Describes problem limit user access
Comment 2 Raphael Marichez (Falco) (RETIRED) gentoo-dev 2007-03-09 21:45:33 UTC
Hi, thanks for your report,


(In reply to comment #0)
> I wrote a long letter and I wanted to send it into pam-list mailing list, but
> my email never appeared in list. See the text in attachment.

probably you haven't subscribed with the right email address


Upstream should fix that weakness so that we and other distros (like debian) will be able to upgrade our packages.
Comment 3 Robert Wolf 2007-03-29 12:00:23 UTC
(In reply to comment #2)
> (In reply to comment #0)
> > I wrote a long letter and I wanted to send it into pam-list mailing list, but
> > my email never appeared in list. See the text in attachment.
> 
> probably you haven't subscribed with the right email address

*** No, I have subscribed with correct address, I have confirmed my subscription  (an email has come for confirmation with URL) and I can login in the pam-list management interface with my email address. Also other emails from mailing list come to my email.

> Upstream should fix that weakness so that we and other distros (like debian)
> will be able to upgrade our packages.

*** does it mean that I should report it to PAM Linux (and maybe to libnss-ldap) or have you already reported?
Comment 4 Robert Wolf 2007-04-25 09:53:45 UTC
Created attachment 117209 [details, diff]
Debian patch to PAM-Linux for Debian 4.0 etch

This is debian patch to PAM-Linux for Debian 4.0 etch, applied to PAM-Linux version 0.79, resulting in debian pam packages version 0.79-4
Comment 5 Robert Wolf 2007-04-25 09:55:46 UTC
Created attachment 117211 [details, diff]
My patch to resolve pam_unix account bug

My patch applied to Debian version of PAM-Linux 0.79-4 to deny access for users without shadow record.
Comment 6 Robert Wolf 2007-04-25 09:57:27 UTC
Hi guys,

I am not C & PAM profi programmer, but I think I found a two bugs in PAM source code regarding to this functionality bug. Both bugs are in the Linux-PAM/modules/pam_unix/pam_unix_acct.c in the function PAM_EXTERN int pam_sm_acct_mgmt:

1) in the code, there is a condition "if (!strcmp( pwent->pw_passwd, "*NP*" )) { /* NIS+ */" for NIS records. If the system do not use NIS, then next condition "else if (_unix_shadowed (pwent))" check if the pwent has shadow record. If shadow record exists, it reads it "spent = _pammodutil_getspnam (pamh, uname);". But if the shadow record does not exist, it returns success (which is IMHO the bug, because on next lines is the test for option "broken_shadow" to get success even if broken shadow record). Therefore I have disabled the "else return PAM_SUCCESS" code. BUT this leads into the next error, because spent is never initialized (see bug (2))

2) there is not initialized struct spwd *spent; and if there is condition "not NIS and not _unix_shadowed (pwent)", then spent is never initialized, but later it is tested in "if (!spent)" conditions. I think there is possibility, that the value of spent is sometimes NULL and sometimes anything else and therefore the conditions "if (!spent)" sometimes passed.

Could you please check it? Thank you very much.

Wolf.
Comment 7 Robert Wolf 2007-04-26 08:24:45 UTC
I got answer from Debian bug tracker, from Steve Langasek:

-----------------------------
No, this is wrong.  If no shadow record exists for the user, there are no
authorization tasks for pam_unix to handle, and returning success here is
the correct thing to do.

If that isn't what you *want* to have happen, then you seem to have
misconfigured PAM.
-----------------------------

In you agree with Steve, please, close this bug, because it is not really a bug. 

Thank you.
Comment 8 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2007-04-30 12:46:44 UTC
Falco, INVALID?
Comment 9 Raphael Marichez (Falco) (RETIRED) gentoo-dev 2007-05-20 21:33:22 UTC
It seems to be a misconfiguration of PAM and at worst, a software bug, probably not a security bug. Robert, i'm closing that bug, feel free to reopen if you disagree. Perhaps you may want to reassign it to the LDAP team.

Debian bug 416628 is not closed yet.