Repository navigation
Design Decision No Response Delays
Status: decided for BFStop 2.0.0 (PR #340) · Affects: the plugin's handling of failed logins, the settings, the update from 1.x · See also: Why No Delay Options in 2.0 (the questions users may have)
BFStop 2.0.0 no longer delays the response to failed logins. All delay settings are removed: "Delay", "Adaptive Delay" and its maximum and thresholds, plus the delays that were added during 2.0.0 development and never released. Failed logins are answered at once, and they are counted and blocked as before.
The account-level throttle was one of the delays, and it is the only part with a purpose of its own: it notices a distributed attack on one account. That detection stays, but it no longer delays anything. While an account is under attack, every address that tries it is blocked after fewer attempts.
Reviews found that a delay held in PHP works against the goal of the extension. It barely slows down attackers, and it gives them a way to make the site unavailable.
BFStop 1.x had two delay settings:
- Delay: a fixed number of seconds to wait before answering a failed login.
- Adaptive Delay: raised that wait linearly from Delay up to Maximum delay while the number of failed logins in the last hour, on the whole site, rose from Minimum threshold to Maximum threshold.
During 2.0.0 development, more delays were added, and with them some safeguards:
- an account-level throttle: an extra 5 seconds once a username had 20 failed logins within 60 minutes, from any addresses (on by default)
- Delay Seconds Per Risk Point: extra seconds for each point of the new risk score
- a cap of 60 seconds per response
- Responses delayed at the same time: at most 5 responses were delayed at once (one lock file per slot), and any further failed login was answered without a delay
The delay itself was sleep() in the PHP request that handled the failed login, after the attempt had been recorded and checked against the block threshold.
- A sleeping PHP request holds a PHP worker (a PHP-FPM child, an Apache process with mod_php, and so on) for the whole delay. Joomla also keeps its database connection open during that time. Shared hosting and small servers often have only 5–20 PHP workers.
- Attackers don't wait for answers. Brute-force tools and botnets send attempts in parallel. A delay therefore costs them nothing, but every delayed request costs the server a worker. Users of other sleep-based login plugins have reported the result: the server runs out of PHP processes under attack and answers 502/503, so the delay itself turns the brute-force attack into a denial of service.
- The safeguard against that made the delay useless under attack. With at most 5 concurrent delays of 5 s each, about one request per second keeps all slots busy. From then on nobody is delayed, while the attacker still holds 5 workers, which can be half the server's capacity.
| Claimed advantage | Assessment |
|---|---|
| Slows down a client that sends one attempt, waits for the answer, then sends the next | True, but blocking stops such a client after the block threshold (10 attempts by default). The delay adds about threshold × delay (≈ 50 s at 5 s) before a block that lasts a day. Negligible.
|
| Slows attackers without locking anybody out (the usual argument for throttling over lockout) | Doesn't apply: BFStop blocks anyway. The only exception was Block Mode "Reporting Only", where the delays were the only countermeasure. |
| The adaptive delay reacts to attacks from many addresses | It slows down every user who mistypes a password during an attack wave, but no attacker who sends in parallel. |
| The account throttle reacts to an attack on one account from many addresses | The detection is valuable: a per-address threshold can't see such an attack. The reaction (a delay) was not. So the detection stays, with a different reaction (see Decision). |
| Disadvantage | Detail |
|---|---|
| Helps attackers make the site unavailable | Each delayed request holds a PHP worker and a database connection. With 5 slots at 5 s, about 1 request/s keeps them all busy. |
| No effect on today's attacks | Credential stuffing and distributed brute force spread their attempts over thousands to millions of addresses, a few attempts each, in parallel. |
| Ineffective exactly when needed | Once the slots are full (that is, under attack), no response is delayed any more. |
| Costs legitimate users | The account owner waited on every typo while their account was attacked, and the adaptive delay slowed everybody down during a wave. |
| Doesn't hide anything | The response is the same, only later. Not answering at all is no better: PHP can't hold a connection open without a worker. |
| Code and maintenance | 8 settings on 2 tabs, a lock-file slot mechanism in the temporary directory, an extra query per failed login (adaptive delay), about a dozen tests, strings in 10 languages. |
- OWASP Top 10 A07:2021: "Limit or increasingly delay failed login attempts, but be careful not to create a denial of service scenario." BFStop's block limits the attempts. The delay only added the denial-of-service risk the sentence warns about.
- NIST SP 800-63B-4, section 3.2.2: verifiers must implement rate limiting that effectively limits the number of failed attempts on an account. That requires a limit, not a delay. Blocking per address, together with the account signal below, meets it.
- OWASP Credential Stuffing Prevention Cheat Sheet: attack tools with proxy support defeat IP block lists and per-address rate limiting, because the volume per address stays low. You have to look at the population: for example, many addresses aimed at one account. That is what the account signal does.
- Static analysis rules flag
sleep()in web code for the same reason. Sonar notes that it is "sometimes used in a mistaken attempt to prevent Denial of Service (DoS) attacks by throttling response rate". - Slowing clients down cheaply is the job of the web server, which holds connections in an event loop rather than in a PHP process: nginx
limit_req, Apachemod_evasive/mod_qos, or fail2ban, which blocks at the firewall.
| Option | Verdict |
|---|---|
| Keep the delays, with the cap and the slots | Rejected: the cap makes them ineffective under attack and still hands attackers 5 workers. |
| Keep only the account throttle's delay | Rejected: same worker problem, and distributed attackers don't wait for the answer. |
| Account detection → mail to the administrators only | Possible, but it doesn't protect anything by itself. |
| Account detection → a signal of the risk score (chosen) | Every address trying an attacked account is blocked sooner. Costs no worker, and works against attackers who don't wait. |
| Remove everything, including the account detection | Simplest, but 2.0.0 would no longer react to a distributed attack on one account at all. |
-
Removed settings:
-
Delay (
delayDuration) -
Adaptive Delay (
adaptiveDelay), withadaptiveDelayMax,adaptiveDelayThresholdMinandadaptiveDelayThresholdMax -
Responses delayed at the same time (
delayMaxConcurrent) - the throttle's Additional Delay (
accountThrottleDelay) -
Delay Seconds Per Risk Point (
riskDelaySecondsPerPoint)
-
Delay (
-
Removed code: the plugin's
Responder::delay()and its lock files,BlockPolicy::delaySeconds()and the query of the failed logins of the last hour. -
Kept and changed: the detection of distributed attacks on one account, in the settings tab "Distributed Attacks on One Account".
-
Detect Distributed Attacks on One Account (
accountAttackEnabled, on by default) -
Failed Attempts per Account (
accountBlockNumber, default 20) -
Counting Window (Minutes) (
accountCheckInterval, default 60) - new: Risk Points While Under Attack (
accountAttackPoints, default 3)
Once a username has had Failed Attempts per Account failed logins within the Counting Window, from any addresses, each further failed login for it scores Risk Points While Under Attack more. With the default Block Threshold Change Per Risk Point of 1, each point lowers that address's block threshold by one, down to Minimum Allowed Attempts. With the defaults, an address trying an attacked account is blocked after 7 failed logins instead of 10. The username is counted the way it is stored, so a username that doesn't exist is counted by its hash. As before, only failed logins that haven't led to a block yet count.
-
Detect Distributed Attacks on One Account (
-
Update from 1.x: the update removes the five delay settings of 1.5.2 from the stored settings. If they actually delayed responses (Delay above 0, or Adaptive Delay on with a maximum above 0), the administrator gets a notice after the update. It explains the change and recommends the web server's rate limiting. The settings added during 2.0.0 development were never released, so they need no migration (nor do lock files: 1.5.2 created none).
For security:
- Attackers can no longer use BFStop to tie up PHP workers or database connections.
- A failed login is now handled as soon as it is recorded and checked against the threshold.
- A distributed attack on one account now gets its addresses blocked sooner. Before, it only cost them a 5-second delay, which they could avoid by sending in parallel.
- Serial attackers from a single address are affected about as much as before: they are blocked after the threshold.
For users and administrators:
- Nobody waits after a typo any more.
- While an account is under attack, its real owner gets fewer attempts on an address the account was never used from (7 by default). From an address they have logged in from before, the known-IP trust signal (Known-IP Trust Points, 5 by default) more than makes up for it. If they still get blocked, the unblock mail ("User Block Message") and the password reset are still available.
- Sites updated from 1.x that used a delay get a notice. Their failed logins are now answered at once.
- With the Block Mode "Reporting Only", BFStop only records failed logins and sends notifications. Before, a configured delay still slowed attempts down.
- Anything that wrote the removed setting keys directly (unlikely) has to drop them.
For the code:
- 8 settings fewer and one mechanism (lock-file slots) fewer.
- One query fewer per failed login when the adaptive delay was on.
- The risk score now has six signals.
Operational recommendation: to slow clients down, configure rate limiting where it costs no PHP worker. The Why No Delay Options in 2.0 page has examples for nginx, Apache and fail2ban.
- OWASP Top 10 A07:2021 – Identification and Authentication Failures
- OWASP Authentication Cheat Sheet
- OWASP Credential Stuffing Prevention Cheat Sheet
- NIST SP 800-63B-4, section 3.2.2 (rate limiting)
- Sonar rule RSPEC-2964: "sleep" should not be called
- clearPHP: no-sleep
- Report: a sleep-based login delay exhausting the PHP processes under attack (WordPress support forum)
- DataDome: a heavily distributed credential stuffing attack (vendor report: about 1.2 attempts per address over 91 million addresses)
- NGINX blog: Rate Limiting with NGINX
- Issue #76 (adaptive allowance of failed attempts)
BFStop 2.x (upcoming)
- Download and Installation 2.x
- Configuration 2.x
- Feature Descriptions 2.x
- FAQ 2.x
- Known issues 2.x
- Upgrading to 2.0
- Why No Delay Options in 2.0
- Design Decision No Response Delays
BFStop 1.5.x (current stable)
General