-
Notifications
You must be signed in to change notification settings - Fork 32
Rate-limit password-based logins and registrations #2541
Comments
Rate limiting isn't my area of expertise but my first instinct is to look at what Synapse currently does and use that as a baseline: It looks like the algorithm used is "leaky bucket as a meter" (https://github.com/element-hq/synapse/blob/d221512498f7e3267916a289dd2ef4f3e00728e8/synapse/api/ratelimiting.py#L40) As for keys, synapse rate limits against several keys: ip address, account, and failed attempts. The rate limits are configurable and the defaults are:
These limits are in-process/non-persistent, and from what I can glean from the code the rate limits appear to be applied per worker, but I would just double-check in the backend room that I am not mistaken about that. |
I'd take some inspiration from https://owasp.org/www-community/controls/Blocking_Brute_Force_Attacks and then here are some suggestions:
|
Thanks both for the input! I had a first shot at it in #3013 I'm using the For logins, I'm keeping two rate limiting buckets:
(…writing this, it feels obvious that I need to tweak those numbers 😅) The state is in-process, checked server-side, and shouldn't cost much, as governor looks quite efficient I don't distinguish failed attempts, because the library doesn't let me 'test' the rate limiter without consuming a cell |
Unless those limits just count the failed attempts, I'd relax the one per IP address quite a bit, for example if a company has just one public IP for lots of employees, or a library or a school. For the second one, I'd go much more aggressive instead: |
Questions to answer:
The text was updated successfully, but these errors were encountered: