Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix login throttle handling #2156

Merged
merged 1 commit into from
May 28, 2024
Merged

fix login throttle handling #2156

merged 1 commit into from
May 28, 2024

Conversation

slingamn
Copy link
Member

We were checking the login throttle at the beginning of every SASL conversation. This had several problems:

  1. Pidgin (on Windows?) tries every mechanism in order, regardless of the CAP advertisement. It would use up the default throttle allowance trying unsupported mechanisms like CRAM-MD5.
  2. The throttle was actually checked twice for AUTHENTICATE PLAIN (once at the start of the conversation and once in AuthenticateByPassphrase).

The general pattern here is that we should check the throttle every time we do something "expensive" (bcrypt verification, send a reset email) or "dangerous" (anything that could lead to a bruteforce attack on passwords). Therefore, delete the check from the AUTHENTICATE handler, and add one at the beginning of the SCRAM conversation to replace it.

We were checking the login throttle at the beginning of every SASL
conversation. This had several problems:

1. Pidgin (on Windows?) tries every mechanism in order, regardless of
the CAP advertisement. It would use up the default throttle allowance
trying unsupported mechanisms like CRAM-MD5.
2. The throttle was actually checked twice for AUTHENTICATE PLAIN
(once at the start of the conversation and once in AuthenticateByPassphrase).

The general pattern here is that we should check the throttle every time we
do something "expensive" (bcrypt verification, send a reset email) or
"dangerous" (anything that could lead to a bruteforce attack on passwords).
Therefore, delete the check from the AUTHENTICATE handler, and add one at
the beginning of the SCRAM conversation to replace it.
@slingamn slingamn added this to the v2.14 milestone May 26, 2024
@slingamn
Copy link
Member Author

Reported by donio and pathof

@slingamn slingamn added the bug label May 26, 2024
@slingamn slingamn merged commit 5ee32cd into ergochat:master May 28, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant