[openssh-commits] [openssh] 56/87: upstream: fix inconsistency between unpriv hostbased code and

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Oct 30 20:21:33 AEDT 2026


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit 3b42f3a2f4625b09aa12cb4823535ceea07355da
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Fri Oct 30 06:35:25 2026 +0000

    upstream: fix inconsistency between unpriv hostbased code and
    
    monitor that could be used to probe account existence when this
    authentication method is enabled.
    
    Anthropic ANT-2026-60RCCQ1O
    
    OpenBSD-Commit-ID: 07605a647a738f383678f244926cd43e833dba8c
---
 auth2-hostbased.c | 10 +++++++---
 auth2.c           |  5 ++++-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/auth2-hostbased.c b/auth2-hostbased.c
index cca06745e..0f8840fbe 100644
--- a/auth2-hostbased.c
+++ b/auth2-hostbased.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth2-hostbased.c,v 1.59 2026/09/16 00:31:27 djm Exp $ */
+/* $OpenBSD: auth2-hostbased.c,v 1.60 2026/10/30 06:35:25 djm Exp $ */
 /*
  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
  *
@@ -62,7 +62,7 @@ userauth_hostbased(struct ssh *ssh, const char *method)
 	Authctxt *authctxt = ssh->authctxt;
 	struct sshbuf *keyblob = NULL, *b = NULL;
 	struct sshkey *key = NULL;
-	char *pkalg, *cuser, *chost;
+	char *pkalg, *cuser, *chost, *userstyle = NULL;
 	u_char *sig;
 	size_t alen, slen;
 	int r, pktype, authenticated = 0;
@@ -136,9 +136,12 @@ userauth_hostbased(struct ssh *ssh, const char *method)
 	if ((b = sshbuf_new()) == NULL)
 		fatal_f("sshbuf_new failed");
 	/* reconstruct packet */
+	xasprintf(&userstyle, "%s%s%s", authctxt->user,
+	    authctxt->style ? ":" : "",
+	    authctxt->style ? authctxt->style : "");
 	if ((r = sshbuf_put_stringb(b, ssh->kex->session_id)) != 0 ||
 	    (r = sshbuf_put_u8(b, SSH2_MSG_USERAUTH_REQUEST)) != 0 ||
-	    (r = sshbuf_put_cstring(b, authctxt->user)) != 0 ||
+	    (r = sshbuf_put_cstring(b, userstyle)) != 0 ||
 	    (r = sshbuf_put_cstring(b, authctxt->service)) != 0 ||
 	    (r = sshbuf_put_cstring(b, method)) != 0 ||
 	    (r = sshbuf_put_string(b, pkalg, alen)) != 0 ||
@@ -168,6 +171,7 @@ done:
 	sshbuf_free(b);
 	sshbuf_free(keyblob);
 	free(pkalg);
+	free(userstyle);
 	free(cuser);
 	free(chost);
 	free(sig);
diff --git a/auth2.c b/auth2.c
index 2da7a4da9..db9e6695f 100644
--- a/auth2.c
+++ b/auth2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth2.c,v 1.176 2026/09/16 00:37:07 djm Exp $ */
+/* $OpenBSD: auth2.c,v 1.177 2026/10/30 06:35:25 djm Exp $ */
 /*
  * Copyright (c) 2000 Markus Friedl.  All rights reserved.
  *
@@ -292,6 +292,9 @@ input_userauth_request(int type, uint32_t seq, struct ssh *ssh)
 
 	if ((style = strchr(user, ':')) != NULL)
 		*style++ = 0;
+	/* An empty style is no style; the monitor treats it the same way. */
+	if (style != NULL && *style == '\0')
+		style = NULL;
 
 	if (authctxt->attempt >= 1024)
 		auth_maxtries_exceeded(ssh);

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list