Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
2.0.0 (unreleased)
- Requires PHP 8.2 (was 8.1), the oldest version CI runs the tests on
- Removed: the delay of the response to failed logins ("Delay", "Adaptive
Delay" and its thresholds). A response held back by PHP holds a PHP
worker for the whole delay, which an attacker sending failed logins in
parallel, from many addresses (an IPv6 network gives plenty), can use to
run the server out of workers, while it hardly slows down anybody who
doesn't wait for one answer before sending the next attempt; blocking
stops a single address long before a delay would matter. Failed logins
are now answered at once, and counted and blocked as before. The update
removes the settings and tells the administrator if they delayed
responses; to slow down clients, use the rate limiting of the web server
or a proxy (e.g. nginx's limit_req, Apache's mod_evasive or mod_qos,
fail2ban). With "Reporting Only" as the blocking mode, BFStop now only
records failed logins and sends notifications. The wiki has the details:
"Design Decision No Response Delays" and "Why No Delay Options in 2.0"
- Hardening (issue #285): the page shown to a blocked address and the
unblock page may not be shown in another site's frame, and the unblock
page's type is not left to the browser to guess; with a proxy
Expand Down Expand Up @@ -181,9 +195,8 @@
Joomla's events; what it did itself is split up in src/Service:
RequestClassifier (what a request does - a login, the unblock page, the
password recovery), BlockPolicy (when, for how long and how a client is
blocked, the unblock mail, the delays), Responder (the block page, the
messages, the delayed response), LoginTurn (logins of one address one
after the other) and DailyMaintenance (see the Task Scheduler entry).
blocked, the unblock mail), Responder (the block page, the messages),
LoginTurn (logins of one address one after the other) and DailyMaintenance (see the Task Scheduler entry).
RequestClassifier works out what
Joomla will run the way Joomla's own code does, which is no API: a new
test, RequestClassifierTest, compares it with what the Joomla version
Expand Down Expand Up @@ -332,12 +345,15 @@
(Components -> Brute Force Stop -> Settings); the plugin's Options tab
and description now just point there instead of holding real settings
- Adaptive allowance of failed attempts (#76): failed logins for a
username are now also throttled across all source IPs combined, not
just per IP, so a distributed attack spreading attempts against one
account across many IPs can no longer evade the per-IP threshold; a
new per-attempt risk score (known IP/username pairs, common usernames,
missing User-Agent, optional GeoIP country and reverse-DNS signals)
adjusts the delay and allowed-attempts threshold; optional progressive
username are now also counted across all source IPs combined, not just
per IP: once an account has had too many of them ("Distributed Attacks
on One Account", default 20 within 60 minutes), every address trying it
is blocked after fewer attempts, so a distributed attack spreading
attempts against one account across many IPs no longer goes unnoticed
by the per-IP threshold; a new per-attempt risk score (known
IP/username pairs, common usernames, missing User-Agent, optional GeoIP
country and reverse-DNS signals, an attacked account) adjusts the
allowed-attempts threshold; optional progressive
(exponential) block duration for repeat offenders; password reset/
username reminder now stay reachable even for a blocked IP
- Notifications of failed logins only for existing accounts (#172): the new
Expand Down Expand Up @@ -392,12 +408,9 @@
and private client addresses reported by the proxy are accepted. Not
all proxies append to an incoming header: pick a header yours sets or
appends to
- Security: a failed login is now recorded, counted and checked against
the block threshold before the configured delay is applied, not after
it, and a request whose IP address just got (or already is) blocked is
not delayed any more. Before, a burst of parallel login attempts all
ran before the first of them was counted, and every one of them held
on to a server worker for the whole delay
- Security: a failed login is now recorded and counted before anything
else is done with it (the risk score, the mails). Before, a burst of
parallel login attempts all ran before the first of them was counted
- Security: usernames of failed logins which do not belong to an existing
account (and are not on the list of common usernames) are now stored,
shown, logged and mailed as an unreadable hash by default, as users
Expand Down Expand Up @@ -499,8 +512,8 @@
- Security: the failed logins are indexed by address and by time. With
the 200000 of them that are kept at most, the lookups made for every
failed login took 9-27 ms each (PostgreSQL 16 / MariaDB 10.11), the one
made when an address gets blocked up to 190 ms on MariaDB, and those of
the adaptive delay 8-18 ms; now each takes below 1 ms, while recording
made when an address gets blocked up to 190 ms on MariaDB; now each
takes below 1 ms, while recording
a failed login takes as long as before
- Security: the bundled MaxMind DB reader (maxmind-db/reader, now 1.14.0,
which limits the decoding of malformed or hostile database files) is
Expand Down Expand Up @@ -547,11 +560,6 @@
duration instead of a language key
- Security: failed logins are purged after 4 weeks by default (set the
purge age to 0 for the old behaviour) and limited to 200000 rows
- Security: a response is delayed by 60 seconds at most, however the delay
settings add up, and the account throttle no longer delays an address
that was just blocked. "Delay Duration" and "Maximum Adaptive Delay" go
up to 60 seconds (before: 120); a larger value saved by an earlier
version has to be lowered the next time the settings are saved
- Security: unblock tokens are stored as hashes; links sent before the
update stop working (they are valid for 3 days only)
- Security: usernames in log entries and in mails can no longer contain
Expand Down Expand Up @@ -581,14 +589,6 @@
user has logged in from that IP address before" sends them; the settings
page doesn't take the setting then and says what to add to
configuration.php, and the backend warns about a setting saved before
- Security: delays can no longer be used to run the server out of PHP
workers. A delayed response holds a worker for the whole delay, and an
attacker with many addresses (an IPv6 network gives plenty) could send
failed logins in parallel until none was left. At most "Responses
delayed at the same time" (default 5) responses are delayed at once;
further ones are answered without delay, and still counted and blocked.
The risk score adds no delay by default any more ("Delay Seconds Per
Risk Point" 0, before: 2, i.e. 4 seconds for a failed login as "admin")
- Security: the reverse DNS risk signal can no longer hold a request for
as long as the attacker's name servers like. The lookup is made by the
plugin over UDP, with the name servers of /etc/resolv.conf, and given up
Expand Down
36 changes: 19 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Brute Force Stop for Joomla!

Brute Force Stop (BFStop) protects the login of a Joomla! site against
brute-force attacks. It records failed logins, slows down and blocks the IP
addresses (and throttles the accounts) they come from, notifies you about
failed logins and blocks, and lets users who blocked themselves unblock their
address through a link sent by email.
brute-force attacks. It records failed logins, blocks the IP addresses they
come from (sooner when an account is attacked from many addresses), notifies
you about failed logins and blocks, and lets users who blocked themselves
unblock their address through a link sent by email.

This repository contains all of BFStop, which is released as one package:

Expand Down Expand Up @@ -43,21 +43,23 @@ of another, only those of the library.
*Components → Brute Force Stop → Settings*.
- Joomla! offers updates through its update manager.

### What the delays can and can't do
### Rate limiting

Blocking is what protects the login: an address (an IPv6 client: its
network) gets only so many failed logins. The delays - the delay of the
response to a failed login, the adaptive delay, the account throttle and the
delay per point of the risk score - only slow down a client which waits for
one answer before it sends the next attempt. Each delayed response holds a
PHP worker for as long as it is delayed, so at most "delayMaxConcurrent"
responses are delayed at the same time (and none longer than 60 seconds);
any further failed login is answered at once. An attacker who sends many
attempts in parallel, from many addresses, therefore gets most answers
without delay: the account throttle in particular doesn't stop a distributed
attack on one account, it only makes it a little slower. Holding many
connections open cheaply is something only the web server or a proxy in
front of it can do (e.g. nginx's `limit_req`).
network) gets only so many failed logins, fewer if its attempts look risky
or the account it tries is attacked from many addresses at once. BFStop
answers every failed login at once and doesn't slow clients down: since
2.0.0, there are no delay settings any more. A response held back by PHP
holds a PHP worker for as long, so an attacker sending many attempts in
parallel, from many addresses, could run the server out of workers, while a
delay hardly slows down a client which doesn't wait for one answer before
sending the next attempt. Holding many connections open cheaply is something
only the web server or a proxy in front of it can do: to slow down or limit
requests to the login, use e.g. nginx's
[`limit_req`](https://nginx.org/en/docs/http/ngx_http_limit_req_module.html),
Apache's `mod_evasive` or `mod_qos`, or fail2ban. The wiki explains
[why the delays were removed](https://github.com/codeling/bfstop/wiki/Why-No-Delay-Options-in-2.0)
and has examples.

## Resources

Expand Down
46 changes: 7 additions & 39 deletions component/admin/forms/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -224,38 +224,10 @@
label="COM_BFSTOP_SETTINGS_NGINX_DENY_FILE_LABEL"
description="COM_BFSTOP_SETTINGS_NGINX_DENY_FILE_DESC" />
</fieldset>
<fieldset name="delay" label="PLG_SYSTEM_BFSTOP_DELAY_FIELDSET_LABEL">
<field name="delayDuration" type="integer" validate="options"
default="0" first="0" last="60" step="5"
label="PLG_SYSTEM_BFSTOP_DELAY_DURATION_LABEL"
description="PLG_SYSTEM_BFSTOP_DELAY_DURATION_DESC" />
<field name="adaptiveDelay" type="list" validate="options" default="0"
label="PLG_SYSTEM_BFSTOP_ADAPTIVE_DELAY_LABEL"
description="PLG_SYSTEM_BFSTOP_ADAPTIVE_DELAY_DESC" >
<option value="0">PLG_SYSTEM_BFSTOP_DISABLED</option>
<option value="1">PLG_SYSTEM_BFSTOP_ENABLED</option>
</field>
<field name="adaptiveDelayMax" type="integer" validate="options" default="0"
first="0" last="60" step="5"
label="PLG_SYSTEM_BFSTOP_ADAPTIVE_DELAY_MAX_LABEL"
description="PLG_SYSTEM_BFSTOP_ADAPTIVE_DELAY_MAX_DESC" />
<field name="adaptiveDelayThresholdMin" type="integer" validate="options" default="50"
first="0" last="500" step="25"
label="PLG_SYSTEM_BFSTOP_ADAPTIVE_DELAY_THRSH_MIN_LABEL"
description="PLG_SYSTEM_BFSTOP_ADAPTIVE_DELAY_THRSH_MIN_DESC" />
<field name="adaptiveDelayThresholdMax" type="integer" validate="options" default="200"
first="100" last="2000" step="100"
label="PLG_SYSTEM_BFSTOP_ADAPTIVE_DELAY_THRSH_MAX_LABEL"
description="PLG_SYSTEM_BFSTOP_ADAPTIVE_DELAY_THRSH_MAX_DESC" />
<field name="delayMaxConcurrent" type="integer" validate="options" default="5"
first="1" last="50" step="1"
label="COM_BFSTOP_SETTINGS_DELAY_MAX_CONCURRENT_LABEL"
description="COM_BFSTOP_SETTINGS_DELAY_MAX_CONCURRENT_DESC" />
</fieldset>
<fieldset name="account" label="COM_BFSTOP_SETTINGS_ACCOUNT_FIELDSET_LABEL">
<field name="accountThrottleEnabled" type="list" validate="options" default="1"
label="COM_BFSTOP_SETTINGS_ACCOUNT_THROTTLE_ENABLED_LABEL"
description="COM_BFSTOP_SETTINGS_ACCOUNT_THROTTLE_ENABLED_DESC">
<field name="accountAttackEnabled" type="list" validate="options" default="1"
label="COM_BFSTOP_SETTINGS_ACCOUNT_ATTACK_ENABLED_LABEL"
description="COM_BFSTOP_SETTINGS_ACCOUNT_ATTACK_ENABLED_DESC">
<option value="0">PLG_SYSTEM_BFSTOP_DISABLED</option>
<option value="1">PLG_SYSTEM_BFSTOP_ENABLED</option>
</field>
Expand All @@ -267,10 +239,10 @@
default="60" first="5" last="10080" step="5"
label="COM_BFSTOP_SETTINGS_ACCOUNT_CHECK_INTERVAL_LABEL"
description="COM_BFSTOP_SETTINGS_ACCOUNT_CHECK_INTERVAL_DESC" />
<field name="accountThrottleDelay" type="integer" validate="options"
default="5" first="0" last="60" step="1"
label="COM_BFSTOP_SETTINGS_ACCOUNT_THROTTLE_DELAY_LABEL"
description="COM_BFSTOP_SETTINGS_ACCOUNT_THROTTLE_DELAY_DESC" />
<field name="accountAttackPoints" type="integer" validate="options"
default="3" first="0" last="20" step="1"
label="COM_BFSTOP_SETTINGS_ACCOUNT_ATTACK_POINTS_LABEL"
description="COM_BFSTOP_SETTINGS_ACCOUNT_ATTACK_POINTS_DESC" />
</fieldset>
<fieldset name="geoip" label="COM_BFSTOP_SETTINGS_GEOIP_FIELDSET_LABEL">
<field name="geoDbPath" type="text" size="60" default=""
Expand Down Expand Up @@ -336,10 +308,6 @@
default="2" first="0" last="20" step="1"
label="COM_BFSTOP_SETTINGS_RISK_USERAGENT_POINTS_LABEL"
description="COM_BFSTOP_SETTINGS_RISK_USERAGENT_POINTS_DESC" />
<field name="riskDelaySecondsPerPoint" type="integer" validate="options"
default="0" first="0" last="30" step="1"
label="COM_BFSTOP_SETTINGS_RISK_DELAY_PER_POINT_LABEL"
description="COM_BFSTOP_SETTINGS_RISK_DELAY_PER_POINT_DESC" />
<field name="riskBlockNumberReductionPerPoint" type="integer" validate="options"
default="1" first="0" last="10" step="1"
label="COM_BFSTOP_SETTINGS_RISK_BLOCK_REDUCTION_PER_POINT_LABEL"
Expand Down
Loading