Login Rate Limiting deprecated
Introduction
The Middleware limits failed password checks per client address and, optionally, per login name. Both limits apply to every login with a password, so an attacker gains nothing by switching from one entry point to another:
- the login actions of the HTTP API (
login,formlogin,tokenLogin,login/httpAuth) - Infostore WebDAV (
/servlet/webdav.infostore,/servlet/webdav.drive,/infostore,/files,/drive), including the sessions it keeps per client - CalDAV and CardDAV (
/servlet/dav) - guest logins to shares
- the check of the current password when a user changes it
- the check of a user's password through the SOAP and RMI provisioning interfaces (per login name only, see below)
Logins without a password, such as single sign-on, auto-login or a session's access to a cross-context share, are neither counted nor refused.
Only invalid credentials count, a wrong guest password included. The same login name and password count only once per window, so that a client retrying an outdated password counts as one, while guessing, which tries a new password each time, counts in full. The check that reaches a limit blocks the address or login name: further logins are refused without checking the password, with LGI-0028 on the HTTP API and 429 Too Many Requests on login/httpAuth, WebDAV, CalDAV and CardDAV, until the window has passed since that check.
Limit per client address
Enabled by default.
com.openexchange.ajax.login.maxRateThe number of failed password checks per client address within the window. Default50;0disables the limit.com.openexchange.ajax.login.maxRateTimeWindowThe window in milliseconds. Default300000(5 minutes).
The address is the remote address of the connection, never the clientIP parameter of the login request, which any client may set. Behind proxies it is right only if com.openexchange.server.knownProxies lists them. IPv6 addresses count per /64 network, and their /48 network with 16 times the limit, so that a client cannot escape by rotating through the networks of its assignment.
A successful login does not reset the count: many users may share an address, and whoever owns one valid account must not be able to clear it. Users behind a large NAT share one count, which is why the default is generous.
Since a failure is counted once known, an address that has failed checks has at most 4 passwords checked at the same time on a node; further logins from it wait for their turn up to 10 seconds, and are refused after that.
Limit per login name
Disabled by default.
com.openexchange.ajax.login.rateLimitByLogin.enabledEnables the limit. Defaultfalse.com.openexchange.ajax.login.rateLimitByLogin.permitsThe number of failed password checks per login name within the time frame. Default3.com.openexchange.ajax.login.rateLimitByLogin.timeFrameInSecondsThe time frame. Default30.
The limit counts failures from any address and is reset by a successful login on the node that counted a failure. The login name counts as entered, ignoring case and surrounding white space; another name of the same account, such as an alias, counts on its own. Through the provisioning interfaces, the name counts as <login>@<context identifier>, and no address is known there: keep those interfaces internal, or limit them with com.openexchange.admin.rmi.rate.limit.*.
Anyone who knows a login name can use the limit to keep its owner from logging in for the time frame.
Cluster-wide counting
com.openexchange.ajax.login.rateLimit.clusterWideCounts failures cluster-wide in Redis. Defaulttrue. Withfalse, each node counts its own, so the effective limit is the configured one times the number of nodes.
The limits are built to put little load on Redis:
- The check before a login is answered locally; a regular login costs no Redis command.
- Only a failed login reaches Redis, with one command per limit.
- Once a limit has run out, the node that noticed refuses the address or login name locally until the window has passed. Any other node does so after its next failure of it.
- A successful login resets its login name in Redis only if the same node counted a failure of it.
If Redis cannot be reached, failures are counted per node, and for 30 seconds after it failed, so that failed logins do not keep waiting for it.
The windows are kept between 10 seconds and 12 hours. Changing a limit starts its counts afresh.
Turning off unused entry points
An entry point nobody uses is better turned off than limited:
com.openexchange.ajax.login.disabledActionsA comma-separated list of login actions this node does not serve, e.g.formlogin, httpAuth;httpAuthstands for thelogin/httpAuthpath. A disabled action is answered like an unknown one, whetheractioncomes in the query string or in a form body, which a rule in a reverse proxy easily misses. Reloadable.com.openexchange.webdav.infostore.enabledSet tofalseto stop serving Infostore WebDAV (/servlet/webdav.infostore,/servlet/webdav.drive,/infostore,/files,/drive). Takes effect on restart. CalDAV and CardDAV stay.
Monitoring
The log notes at level INFO when an address, network or login name is blocked, up to 10 times a minute, and how many further ones it left out. The counter appsuite_login_attempts_total counts login attempts by entry point (interface, e.g. HTTP_JSON, WEBDAV_INFOSTORE, CALDAV) and outcome (success, invalid_credentials, throttled, failed). A rise of invalid_credentials on one entry point, or a move from one to another, points to a brute-force attack.
Further protection
For anomaly detection across IMAP and the Middleware, OX Abuse Shield (Weakforced) plugs into the same login listener mechanism through the package open-xchange-weakforced.