pam_succeed_if: prevent logging unknown user names in plaintext#985
Open
lzwind wants to merge 1 commit into
Open
pam_succeed_if: prevent logging unknown user names in plaintext#985lzwind wants to merge 1 commit into
lzwind wants to merge 1 commit into
Conversation
ldv-alt
requested changes
Jun 8, 2026
ldv-alt
left a comment
Member
There was a problem hiding this comment.
Looks like the chosen approach is not correct. Instead, I suggest changing the logging part where the user name is printed: if audit is enabled or the user exists, print the user name as it is printed now, otherwise print an unknown user.
When a user accidentally types their password at the username prompt, pam_succeed_if logs the password in plaintext via pam_syslog. This happens because evaluate_ingroup, evaluate_notingroup, evaluate_innetgr, and evaluate_notinnetgr return PAM_AUTH_ERR or PAM_SUCCESS for non-existent users instead of PAM_USER_UNKNOWN, bypassing the existing log guard. Add pam_modutil_getpwnam() checks in these four functions to return PAM_USER_UNKNOWN when the user does not exist, so the existing logging guard (ret != PAM_USER_UNKNOWN) correctly suppresses the output. Fixes: linux-pam#559
4f943f8 to
f2689ca
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pam_succeed_iflogs the password in plaintext viapam_syslog. This happens becauseevaluate_ingroup,evaluate_notingroup,evaluate_innetgr, andevaluate_notinnetgrreturnPAM_AUTH_ERRorPAM_SUCCESSfor non-existent users instead ofPAM_USER_UNKNOWN, bypassing the existing log guard (ret != PAM_USER_UNKNOWN).evaluate_notingroupshould returnPAM_SUCCESSwhen the user is not in the group), this fix modifies the logging part: check whether the user exists usingpam_modutil_getpwnam(). If the user does not exist andauditis not enabled, print "unknown user" instead of the potentially sensitive user input.Changes
modules/pam_succeed_if/pam_succeed_if.cevaluate(), check if user exists viapam_modutil_getpwnam(). Use"unknown user"in log messages when user does not exist and audit is disabled.Test plan
pam_succeed_if.so user ingroup <group>, logs show "unknown user" instead of the passwordingroup,notingroup,innetgr,notinnetgrqualifiers all behave correctly with both existing and non-existing usersauditflag is set, the actual user input is still logged for debugging purposesFixes: #559