A botnet is recruited to try to authenticate against a website or service with each bot trying infrequently using a common password and a list of 'real' email addresses, avoiding the account lock-out mechanism.


Add a choke in code to limit the max concurrent login requests, plus a long delay in negative response.

The choke allows n simultaneous callers, tuned to normal traffic patterns. When a caller presents invalid creds, the service imposes a 6 second wait and returns 404.

Callers queue on a busy choke, and the choke will throw a 404 if the caller is left queuing for 6s, appearing like a bad login attempt. The choke is held for the entire duration, including the 6s wait for bad creds.

The idea is that if an unusual volume of bad login attempts arrive at the service, then the system will cludge-up quickly and most requests will queue and see a 404, even for valid credentials.

Assuming an attacker figures out that this mechanism exists, I'll have introduced a vector for easily clogging the service up and denying legit users from logging-in; the rest of the service will run fine and the 6s wait does not block a thread.

That said, the load-balancer has call rate limiting so that individual callers repeatedly hitting the login service and making it cludge-up, will eventually be stopped.

The alternative is not having this mechanism at all.

It's not yet live, we're pre-launch so I have no real-world insights. Is this a smart idea or dumb?


  • 2
    So you'll purposely be imposing a Denial of Service to legitimate users if a botnet is trying to hit some low hanging fruit? If your site has a lot of users: Users seem to forget passwords A LOT.. so this may be legitimate invalid password attempts. Seems your user experience will not be so good. Oct 19, 2015 at 15:36
  • Normal usage will be fine. "So you'll purposely be imposing a Denial of Service to legitimate users if a botnet is trying to hit some low hanging fruit?" -- yes. You could say its a bit like a bank locking the door and rolling up its shutters if robbers charge in. If you think that's dumb, cool, I'm here to see if this is something people already do, or not, because of xyz. Oct 20, 2015 at 9:38

2 Answers 2


It is a bit difficult to judge if your scheme is reasonable or too much because it fails to provide any information on what the application does or what the value of the resource being protected is. Your security should be matched to your risk analysis i.e. the likelihood of attackers and the consequences should an attack be successful.

From your description, my main concern would be that you have built in a facility which would assist an attacker in performing a denial of service attack on your site. This may or may not be an issue, depending on your site and how the services are used. For example, if the site is one where users first authenticate and then receive some sort of token which they use for subsequent connections and if that token has a reasonable lifetime, then potential DoS issues may not be a significant problem (assuming most users are already authenticated and are able to continue to use the service). On the other hand, if the token has a short life time and users authenticate quite frequently, then this could be a problem.

From your description, it isn't clear that this is a 'real' threat your trying to protect against or a theoretical attack i.e. an idea someone has had and has decided to protect against. Do you have any evidence or reason to believe the site is likely to be targeted by a botnet style attack as you describe? While the attack type your describe does exist, a vast number of sites/services out there never see such attacks or seldom see them. It this is the situation for your site, it is likely that all this additional complexity brings you is possible inconvenience for legit users who forget their password and added complexity in your system, which has even more potential to create problems or hide vulnerabilities. Increased complexity can easily lead to increased false positives, which may well create frustration with your users and result in lost business.

As an example, just recently I assisted a company with diagnosis of a problem they had with their web application. Users were reporting increased frustration with lost sessions and having to re-authenticate too frequently. The problem turned out to be related to a security feature built into the system.

The application used a JSON web token to manage authentication/authorisation. The user would initially connect and provide their username/password etc and get a token which they could use for subsequent connections. The token had a 24 hour lifetime. All that was fine.

For added security, the token recorded the user's IP address and on each access tot the services, after decrypting the token, the service would check that the IP address recorded in the token was the same as the IP address the connection was coming from. On the face of it, this seemed reasonable. The app was mainly used from inside the corporate network. The company had a large site.

A recent network upgrade at the company resulted in the installation of approx 3000 new wirless access points and a new configuration of the wired and wireless network so that it used 802.1x across wired and wireless networks and a move from assigning IP address based on geographical location to one based on user role. One of the advantages of the new setup is that you could move around the organisation and keep your wireless connection active. As you move between access points, you may get a new connection and that new connection may have a new IP address, but to the end user, it looks like one connection. You can probably see where the problem was.

Due tot he change in IP address, the auth token no longer passed the IP test. The problem was an assumption that the user would retain the same IP address the the lifetime of their connection. However, there was also another more subtle issue. As this application is used on an internal network, which is fairly well locked down with quite a reasonable level of security, the IP check was unlikely to be actually improving security at all. The idea of the IP check was to add additional protection against session hijacking by someone who was able to steal the users token. Although this can be a real risk in some environments, in this specific environment, this was a low risk and the protection was not of any real benefit. Worse still, the data which could be accessed by the application had low value - it was information useful to staff, but was not particularly sensitive and the consequences for unauthorised access were low. This was an example of a security measure being implemented which was based on a theoretical threat rather than a real threat in the environment.

The point is, you need to assess whether your control is really addressing an actual threat or whether it might be a reasonable idea which isn't of any real benefit to your environment and could potentially have a negative impact on legit users. Is the type of attack you describe and are protecting against a real threat in your environment? What would be the consequence if that type of attack succeeded? Will the potential impact on legit users be acceptable to the business? If you enforce strong passwords and use good hashing techniques, how likely is a brute force attack likely to work anyway? I suspect that your measures may be excessive and possibly not providing any real benefit, but that depends on the application.

  • Useful long answer, Tim, thanks. Normal password lockout won't kick in if the attacker tries once per account but uses the same common password for all attempts. The API is public and there's an unrestricted token refresh endpoint, so any DoS would occur for new logins. I take on your point around speculative features - its tricky with security since its all speculative, even home security, car immobilizers, pepper spray. But yes, the risk vs. user impact can be weighed. Your point on assisting attackers has merit, though they'd have to know that mechanism existed (503) to exploit it. Oct 28, 2015 at 11:08

Even if users have really bad passwords (and you can mitigate that), a brute force attempt is going to require a lot of requests in order to have a good chance of being successful. If this attacker is willing to wait a really long time or maybe is attacking lots of websites, a reasonable password reset period should make it really unlikely they will stumble onto a working login.

So really the main way to prevent brute force attacks is to slow them down. In this case the attack is so slow that it is infeasible with good password rules so I'm not sure you really need to defend against it.

On a side note, I think 404 is not the right code. A 503 would be probably be more appropriate. Another option is to implement a delay on login attempts that doubles on every attempt for a user or from an IP (spoofing could defeat this.) For example, you might implement a 2 second delay after one bad attempt and after a few tries, they are SOL. Another thing is that if you see requests for lots of different IDs coming from the same client, you should probably stop servicing the requests entirely. Again spoofing could get around this.

  • Thanks for answering, Jimmy. The idea behind the throttle is to slow them down. Normal traffic volume would pass without hindrance but an influx would slow it all up. As for 503, I don't want to leak information that the service has changed state. It's a public API for a financial company. I emit 404s for all negative responses around the security APIs to prevent attackers 'feeling around', its a trade-off with by-the-book REST. Oct 28, 2015 at 10:55
  • I'm not sure what information 503 provides that a 404 doesn't. Returning 404 will mostly serve to confuse your legitimate clients than it will challenge attackers. As far as the throttling goes, your scenarios assumes that they are going so slow that you cannot detect them which implies (assuming you use good practices) their attack is infeasble. I can almost guarantee that you have more significant vulnerabilities and I would recommend spending your valuable time on finding them.
    – JimmyJames
    Oct 28, 2015 at 16:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .