We are running a Spring MVC / Security 3.x web application with a protected area behind a login. In order to improve our security, we would like to add an increasing delay each time a malicous user or bot retries failing logins (against brute-forcing), like described by Jeff below the headline "Limiting the number.." or at OWASP.
Our application runs in Tomcat 7 with Servlet Spec v2.5 which means we do not have asynchronous servlets, and Thread.sleep()
is a no-go anyway, because this would block the executing thread (like here) and quickly exhaust the thread pool for processing, effectively resulting in a DoS attack against our server. Others have been pointing this out already, so my question is:
- How can I add an arbitrary delay to servlet processing without resorting to multithreading on the server side?
I would like to avoid setting up a custom thread pool for processing, since the servlet spec also states that passing the request / response objects to other threads is not thread-safe (chapter 2.3.3.3 in the Servlet spec linked above).
Thanks a lot for your help!