Skip to content

pam_succeed_if: prevent logging unknown user names in plaintext#985

Open
lzwind wants to merge 1 commit into
linux-pam:masterfrom
lzwind:fix/pam_succeed_if_password_leak
Open

pam_succeed_if: prevent logging unknown user names in plaintext#985
lzwind wants to merge 1 commit into
linux-pam:masterfrom
lzwind:fix/pam_succeed_if_password_leak

Conversation

@lzwind
Copy link
Copy Markdown

@lzwind lzwind commented Jun 2, 2026

Summary

  • 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 (ret != PAM_USER_UNKNOWN).
  • Added pam_modutil_getpwnam() checks in these four functions to return PAM_USER_UNKNOWN when the user does not exist, so the existing logging guard correctly suppresses the output.

Fixes: #559

Test plan

  • Verify that when a non-existent username (e.g., a mistyped password) is passed to pam_succeed_if.so user ingroup <group>, it no longer appears in logs
  • Verify that existing valid user checks still work correctly
  • Verify that ingroup, notingroup, innetgr, notinnetgr qualifiers all behave correctly

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pam_succeed_if logs invalid user names

1 participant