NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/61099: sshd(8): Multiple AuthenticationMethods broken PAM



>Number:         61099
>Category:       bin
>Synopsis:       sshd(8): Multiple AuthenticationMethods broken PAM
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 01 07:40:00 +0000 2026
>Originator:     Taylor R Campbell
>Release:        current, 11, 10, ...
>Organization:
The PamBSD AuthenticationMethods, Inc.
>Environment:
>Description:

	sshd(8) is unable to handle explicit AuthenticationMethods of
	which one is handled by PAM (password or keyboard-interactive):

# /usr/sbin/sshd -o AuthenticationMethods=keyboard-interactive,publickey -dde
...
debug3: auth2_update_methods_lists: updating methods list after "keyboard-interactive/pam"
auth2_update_methods_lists: method not in AuthenticationMethods
debug1: do_cleanup
debug1: Killing privsep child 18324
# 

>How-To-Repeat:

	UsePAM yes
	AuthenticationMethods keyboard-interactive,publickey

	or

	UsePAM yes
	AuthenticationMethods password,publickey

>Fix:

	1. Fix the auth_method / auth_submethod naming in places like
	   this -- no `/pam' suffix in auth_method:

   1224 	auth_method = "keyboard-interactive/pam";
   1225 	auth_submethod = "pam";

	   https://nxr.netbsd.org/xref/src/crypto/external/bsd/openssh/dist/monitor.c?r=1.53#1224

	2. Defer mm_do_pam_account until after we have gone through the
	   authentication methods list:

    415 #ifdef USE_PAM
    416 	if (options.use_pam && authenticated) {
    417 		int success = mm_do_pam_account();
...
    436 #endif
    437 
    438 	if (authenticated && options.num_auth_methods != 0) {
    439 		if (!auth2_update_methods_lists(authctxt, method, submethod)) {
    440 			authenticated = 0;
    441 			partial = 1;
    442 		}
    443 	}
    444 
    445 	/* Log before sending the reply */
    446 	auth_log(ssh, authenticated, partial, method, submethod);
    447 
    448 	/* Update information exposed to session */
    449 	if (authenticated || partial)
    450 		auth2_update_session_info(authctxt, method, submethod);
    451 
    452 	if (authctxt->postponed)
    453 		return;

	   https://nxr.netbsd.org/xref/src/crypto/external/bsd/openssh/dist/auth2.c?r=1.37#415

	   The #ifdef USE_PAM block needs to come after all this, not
	   before.




Home | Main Index | Thread Index | Old Index