NetBSD Problem Report #61099

From www@netbsd.org  Tue Dec  1 07:37:44 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.netbsd.org", Issuer "YR1" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 4B8B91A923B
	for <gnats-bugs@gnats.NetBSD.org>; Tue,  1 Dec 2026 07:37:44 +0000 (UTC)
Message-Id: <20261201073742.D11A01A923D@mollari.NetBSD.org>
Date: Tue,  1 Dec 2026 07:37:42 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: sshd(8): Multiple AuthenticationMethods broken PAM
X-Send-Pr-Version: www-1.0
X-From4GNATS: "campbell+netbsd@mumble.net via gnats" <gnats-admin@NetBSD.org>

>Number:         61099
>Category:       bin
>Synopsis:       sshd(8): Multiple AuthenticationMethods broken PAM
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    riastradh
>State:          needs-pullups
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 01 07:40:00 +0000 2026
>Closed-Date:    
>Last-Modified:  Tue Dec 01 10:32:12 +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.

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: bin-bug-people->riastradh
Responsible-Changed-By: riastradh@NetBSD.org
Responsible-Changed-When: Tue, 01 Dec 2026 08:05:15 +0000
Responsible-Changed-Why:
drafting a patch along with some other stuff


From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/61099 CVS commit: src/crypto/external/bsd/openssh/dist
Date: Tue, 1 Dec 2026 09:12:57 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Tue Dec  1 09:12:57 UTC 2026

 Modified Files:
 	src/crypto/external/bsd/openssh/dist: monitor.c

 Log Message:
 sshd(8): Fix authentication submethod naming for pam.

 This had been presumably broken in some way in 2013 with the
 openssh-6.4 update, which introduced authentication submethods:

 https://mail-index.netbsd.org/source-changes/2013/11/08/msg049052.html

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


 To generate a diff of this commit:
 cvs rdiff -u -r1.53 -r1.54 src/crypto/external/bsd/openssh/dist/monitor.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/61099 CVS commit: src/crypto/external/bsd/openssh/dist
Date: Tue, 1 Dec 2026 09:13:13 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Tue Dec  1 09:13:13 UTC 2026

 Modified Files:
 	src/crypto/external/bsd/openssh/dist: auth2.c

 Log Message:
 sshd(8): Fix ordering of pam account mgmt with multiple auth methods.

 Can't do it until we've completed all of the necessary authentication
 methods.  Otherwise the process fails with:

 debug1: do_pam_account: called
 debug2: do_pam_account: auth information in SSH_AUTH_INFO_0
 debug3: PAM: do_pam_account pam_acct_mgmt = 0 (Success)
 debug3: mm_request_send: entering, type 103
 debug3: auth2_update_methods_lists: updating methods list after "unknown"
 auth2_update_methods_lists: method not in AuthenticationMethods

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


 To generate a diff of this commit:
 cvs rdiff -u -r1.37 -r1.38 src/crypto/external/bsd/openssh/dist/auth2.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->needs-pullups
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Tue, 01 Dec 2026 10:32:12 +0000
State-Changed-Why:
fixed in HEAD, needs pullup-11 and pullup-10


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.