c54ec52f0f
fix(auth): limit failed TOTP attempts per account ( #39993 )
...
Gitea accepted unlimited wrong TOTP passcodes, so anyone holding an
account's password could enumerate the 6-digit code in minutes. This
allows 5 failed attempts per account, then refuses TOTP until 15 minutes
after the last one.
- The count lives in the cache, and the global lock spans the check,
validation and counting, so new sessions and concurrent requests cannot
widen it. With Redis, both are shared across instances
- Applies to every TOTP check: the web 2FA page, account recovery and
Basic auth with `X-Gitea-OTP` (API, git, packages)
- Only wrong or replayed passcodes count, server errors do not
- Scratch codes and WebAuthn stay usable as the recovery path while
locked
- Failures log `Failed authentication attempt for <user> from <ip>`,
which the fail2ban filter already matches
---------
Co-authored-by: silverwind <me@silverwind.io >
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com >
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com >
2026-11-07 23:01:49 +00:00
..
2026-11-06 08:23:13 +00:00
2026-10-18 12:56:04 +00:00
2026-09-26 22:52:19 +00:00
2026-09-26 07:42:36 +00:00
2026-10-24 13:48:19 +00:00
2026-10-31 14:28:58 +00:00
2026-10-30 18:54:07 +00:00
2026-10-18 12:56:04 +00:00
2026-11-07 12:55:19 +00:00
2026-09-30 21:42:07 -06:00
2026-09-26 08:01:41 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-05-26 15:49:31 -07:00
2026-10-22 01:48:49 +00:00
2026-10-24 13:48:19 +00:00
2026-10-18 07:08:55 +00:00
2026-10-24 13:48:19 +00:00
2026-10-30 21:41:59 +00:00
2026-08-07 20:56:40 -07:00
2026-10-24 13:48:19 +00:00
2026-07-25 21:31:19 +00:00
2026-10-22 01:48:49 +00:00
2026-10-31 17:31:59 +01:00
2026-11-06 08:08:20 +00:00
2026-05-26 15:49:31 -07:00
2026-11-04 17:24:33 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-06-27 12:09:01 +00:00
2026-08-29 07:50:04 +00:00
2026-10-31 09:31:56 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-10-31 13:03:59 +01:00
2026-10-24 13:48:19 +00:00
2026-11-04 17:34:29 +00:00
2026-10-24 13:48:19 +00:00
2026-10-31 12:30:07 +00:00
2026-05-26 15:49:31 -07:00
2026-11-07 09:34:21 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-06-10 17:34:10 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-09-06 09:49:27 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-10-27 21:40:42 +01:00
2026-10-31 17:31:55 +01:00
2026-05-26 15:49:31 -07:00
2026-10-21 18:52:33 +08:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-10-27 21:40:42 +01:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-05-26 15:49:31 -07:00
2026-10-24 13:48:19 +00:00
2026-07-16 11:51:36 +02:00
2026-10-24 13:48:19 +00:00
2026-07-28 17:04:22 +00:00
2026-11-05 15:19:09 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-11-04 01:42:41 +00:00
2026-10-24 13:48:19 +00:00
2026-10-29 18:10:36 +00:00
2026-10-19 00:34:01 +00:00
2026-10-24 13:48:19 +00:00
2026-08-09 12:55:43 +00:00
2026-10-24 13:48:19 +00:00
2026-10-01 07:50:47 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-08-24 07:28:17 +00:00
2026-10-24 13:48:19 +00:00
2026-11-07 10:45:05 +00:00
2026-08-24 18:26:10 +00:00
2026-10-24 13:48:19 +00:00
2026-08-24 07:28:17 +00:00
2026-10-24 13:48:19 +00:00
2026-10-23 01:53:45 +00:00
2026-10-23 01:53:45 +00:00
2026-10-24 13:48:19 +00:00
2026-11-07 14:19:50 +00:00
2026-11-05 18:26:32 +00:00
2026-05-26 15:49:31 -07:00
2026-11-06 08:23:13 +00:00
2026-05-26 15:49:31 -07:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-10-19 09:15:41 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-05-26 15:49:31 -07:00
2026-10-24 13:48:19 +00:00
2026-05-26 15:49:31 -07:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-07-28 17:04:22 +00:00
2026-08-03 06:41:27 +00:00
2026-08-03 06:41:27 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-05-26 15:49:31 -07:00
2026-10-24 00:18:51 +00:00
2026-10-18 12:56:04 +00:00
2026-10-24 13:48:19 +00:00
2026-09-29 14:43:36 +02:00
2026-10-24 13:48:19 +00:00
2026-10-18 12:56:04 +00:00
2026-05-26 15:49:31 -07:00
2026-11-04 17:34:29 +00:00
2026-05-26 15:49:31 -07:00
2026-08-23 06:35:55 +00:00
2026-10-30 20:37:37 +00:00
2026-10-24 13:48:19 +00:00
2026-11-04 17:34:29 +00:00
2026-10-24 13:48:19 +00:00
2026-05-26 15:49:31 -07:00
2026-11-07 11:16:11 +00:00
2026-05-26 15:49:31 -07:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-11-07 23:01:49 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-10-30 06:35:11 +08:00
2026-10-19 00:34:01 +00:00
2026-05-26 15:49:31 -07:00
2026-06-08 16:58:42 +08:00
2026-10-24 13:48:19 +00:00
2026-10-19 00:34:01 +00:00
2026-10-24 13:48:19 +00:00
2026-05-26 15:49:31 -07:00
2026-11-01 06:57:30 +00:00
2026-10-24 13:48:19 +00:00
2026-08-22 08:08:36 +00:00
2026-10-24 13:48:19 +00:00
2026-11-03 16:20:39 +00:00
2026-11-07 09:43:39 +00:00
2026-08-14 02:15:33 +00:00
2026-10-24 13:48:19 +00:00
2023-06-29 23:22:55 +00:00
2026-10-14 07:19:49 +00:00
2026-10-24 13:48:19 +00:00
2026-06-29 15:10:47 +00:00
2026-10-24 13:48:19 +00:00
2026-05-26 15:49:31 -07:00
2026-05-26 15:49:31 -07:00
2026-10-02 21:08:14 +02:00
2026-05-26 15:49:31 -07:00
2026-10-24 13:48:19 +00:00
2026-10-04 16:26:14 +08:00
2026-10-24 13:48:19 +00:00
2026-10-24 01:15:31 +00:00
2026-11-06 08:08:20 +00:00
2026-05-26 15:49:31 -07:00
2026-05-26 15:49:31 -07:00
2026-10-24 13:48:19 +00:00
2026-10-31 13:03:59 +01:00
2026-11-06 08:08:20 +00:00
2026-10-05 05:25:54 +00:00
2026-05-26 15:49:31 -07:00
2026-10-24 13:48:19 +00:00
2026-11-07 03:20:25 +00:00
2026-10-19 00:34:01 +00:00
2026-05-26 15:49:31 -07:00
2026-10-24 13:48:19 +00:00
2026-08-29 19:54:07 +00:00
2026-10-24 13:48:19 +00:00
2026-06-18 12:02:11 +00:00
2026-10-24 13:48:19 +00:00
2026-10-18 12:56:04 +00:00
2026-07-12 17:14:09 +00:00
2026-10-30 06:35:11 +08:00
2026-05-26 15:49:31 -07:00
2026-07-31 11:05:41 +00:00
2026-10-24 13:48:19 +00:00
2026-05-26 15:49:31 -07:00
2026-10-24 13:48:19 +00:00
2026-10-28 20:38:45 +08:00
2026-11-02 19:30:55 +00:00
2026-10-24 13:48:19 +00:00
2026-10-24 13:48:19 +00:00
2026-11-06 08:23:13 +00:00
2026-10-31 17:47:36 +00:00
2026-05-26 15:49:31 -07:00
2026-10-31 18:20:56 +01:00
2026-08-21 07:28:23 +00:00
2026-05-26 15:49:31 -07:00
2026-08-17 20:30:24 +00:00
2026-10-24 13:48:19 +00:00
2026-08-17 20:30:24 +00:00
2026-05-26 15:49:31 -07:00
2026-10-24 13:48:19 +00:00
2022-09-02 15:18:23 -04:00
2026-11-04 01:42:41 +00:00
2026-11-06 20:45:17 +00:00
2026-10-24 13:48:19 +00:00
2026-05-26 15:49:31 -07:00
2026-11-05 21:58:17 +00:00
2026-09-02 17:07:04 +00:00
2026-10-30 20:18:13 +00:00
2026-11-06 08:08:20 +00:00
2026-11-06 07:31:58 +00:00
2026-10-06 17:28:28 +00:00
2026-10-19 00:34:01 +00:00
2026-10-24 13:48:19 +00:00
2026-05-26 15:49:31 -07:00
2026-10-24 13:48:19 +00:00
2026-10-28 20:38:45 +08:00
2026-08-10 01:25:31 +00:00
2026-05-26 15:49:31 -07:00
2026-11-01 06:27:12 +00:00
2026-10-30 17:28:47 +00:00
2026-05-26 15:49:31 -07:00
2026-10-19 00:34:01 +00:00
2026-10-24 13:48:19 +00:00
2026-10-31 14:51:43 +00:00
2026-10-28 20:38:45 +08:00
2026-10-28 09:19:35 +00:00
2026-11-06 11:59:49 +00:00
2026-10-24 13:48:19 +00:00
2026-05-26 15:49:31 -07:00
2026-05-26 15:49:31 -07:00
2026-11-04 17:25:51 +00:00
2026-10-24 13:48:19 +00:00
2026-10-02 21:08:14 +02:00
2026-10-24 13:48:19 +00:00
2026-11-07 13:34:01 +00:00
2026-10-02 22:21:41 +08:00
2026-08-27 16:34:44 +00:00
2026-05-26 15:49:31 -07:00
2026-05-26 15:49:31 -07:00
2026-11-04 01:42:41 +00:00
2026-11-04 01:42:41 +00:00
2026-11-04 18:11:25 +00:00
2026-10-05 19:12:22 +02:00
2026-10-29 05:18:17 +00:00
2026-11-02 14:30:41 +00:00
2026-10-19 00:34:01 +00:00