ergochat / ergo

A modern IRC server (daemon/ircd) written in Go.
https://ergo.chat/
MIT License
2.26k stars 180 forks source link

fix login throttle handling #2156

Closed slingamn closed 4 months ago

slingamn commented 4 months ago

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 commented 4 months ago

Reported by donio and pathof