[openssh-commits] [openssh] 04/14: upstream: Record authentication attempts earlier in server

git+noreply at mindrot.org git+noreply at mindrot.org
Thu Nov 26 10:20:49 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 a68166f62521b52cb84b536bbc82365eee0f1f3b
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Wed Nov 25 20:42:32 2026 +0000

    upstream: Record authentication attempts earlier in server
    
    lifecycle and change precedence of exit values used to signal server state.
    
    Closes weak username validity oracle via PerSourcePenalties, that was
    fairly aggressively rate-limited in the default config.
    
    Anthropic ANT-2026-KQAHPGQP
    
    OpenBSD-Commit-ID: 84870145b42f5a6617cba5acc61fd4bc0012a648
---
 monitor.c      |  3 ++-
 sshd-session.c | 13 ++++++++-----
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/monitor.c b/monitor.c
index 17159272b..749e00815 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor.c,v 1.263 2026/10/30 04:52:11 djm Exp $ */
+/* $OpenBSD: monitor.c,v 1.264 2026/11/25 20:42:32 djm Exp $ */
 /*
  * Copyright 2002 Niels Provos <provos at citi.umich.edu>
  * Copyright 2002 Markus Friedl <markus at openbsd.org>
@@ -893,6 +893,7 @@ mm_answer_pwnamallow(struct ssh *ssh, int sock, struct sshbuf *m)
 		fatal_fr(r, "parse");
 
 	pwent = getpwnamallow(ssh, authctxt->user);
+	auth_attempted = 1;
 
 	setproctitle("%s [priv]", pwent ? authctxt->user : "unknown");
 
diff --git a/sshd-session.c b/sshd-session.c
index 3847ffcab..e8f29980d 100644
--- a/sshd-session.c
+++ b/sshd-session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshd-session.c,v 1.27 2026/11/25 07:18:36 djm Exp $ */
+/* $OpenBSD: sshd-session.c,v 1.28 2026/11/25 20:42:32 djm Exp $ */
 /*
  * SSH2 implementation:
  * Privilege Separation:
@@ -1365,10 +1365,13 @@ cleanup_exit(int i)
 	if (the_active_state != NULL && mm_is_monitor())
 		audit_event(the_active_state, SSH_CONNECTION_ABANDON);
 #endif
-	/* Override default fatal exit value when auth was attempted */
-	if (i == 255 && monitor_auth_attempted())
-		_exit(EXIT_AUTH_ATTEMPTED);
+	/*
+	 * Override default fatal exit value when auth was attempted.
+	 * An invalid user takes precedence over a plain auth failure.
+	 */
 	if (i == 255 && monitor_invalid_user())
 		_exit(EXIT_INVALID_USER);
+	if (i == 255 && monitor_auth_attempted())
+		_exit(EXIT_AUTH_ATTEMPTED);
 	_exit(i);
-}
+ }

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


More information about the openssh-commits mailing list