diff options
author | djm@openbsd.org <djm@openbsd.org> | 2022-02-23 12:18:13 +0100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2022-02-23 12:22:20 +0100 |
commit | 32ebaa0dbca5d0bb86e384e72bebc153f48413e4 (patch) | |
tree | ff93af97a74281386553f8ffcd44ff39c62b79f1 /auth2.c | |
parent | upstream: randomise the password used in fakepw (diff) | |
download | openssh-32ebaa0dbca5d0bb86e384e72bebc153f48413e4.tar.xz openssh-32ebaa0dbca5d0bb86e384e72bebc153f48413e4.zip |
upstream: avoid integer overflow of auth attempts (harmless, caught
by monitor)
OpenBSD-Commit-ID: 488ad570b003b21e0cd9e7a00349cfc1003b4d86
Diffstat (limited to '')
-rw-r--r-- | auth2.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -1,4 +1,4 @@ -/* $OpenBSD: auth2.c,v 1.163 2021/12/26 23:34:41 djm Exp $ */ +/* $OpenBSD: auth2.c,v 1.164 2022/02/23 11:18:13 djm Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * @@ -279,6 +279,8 @@ input_userauth_request(int type, u_int32_t seq, struct ssh *ssh) if ((style = strchr(user, ':')) != NULL) *style++ = 0; + if (authctxt->attempt >= 1024) + auth_maxtries_exceeded(ssh); if (authctxt->attempt++ == 0) { /* setup auth context */ authctxt->pw = PRIVSEP(getpwnamallow(ssh, user)); @@ -287,6 +289,7 @@ input_userauth_request(int type, u_int32_t seq, struct ssh *ssh) authctxt->valid = 1; debug2_f("setting up authctxt for %s", user); } else { + authctxt->valid = 0; /* Invalid user, fake password information */ authctxt->pw = fakepw(); #ifdef SSH_AUDIT_EVENTS |