I do not agree. I feel that blocking a username is generally safer (excluding IP).
What happens when a malicious hacker spoofs an IP address? A hacker can navigate IP addresses and constantly brute force username.
I am blocked after three attempts in 15 minutes.
Comments on your board:
I would do something like this:
if(resolveTimeOuts()){ bool uid = UserExists(); //do other stuff }else{ "Your IP has been locked. Enter this code to prove you are human." // Captcha or math equation. }
Although, I would not delete expired IP requests in resolveTimeOuts() . This may increase the execution time of the function. Do something like this:
if(resolveTimeOut()){ bool uid = UserExists(); //do other stuff }else{ "Your IP has been locked. Enter this code to prove you are human." if(rand(1,5) == 5){ // or something equivalent deleteExpiredRequests(); } // Captcha or math equation. }
This would ensure that resolveTimeOut() executed resolveTimeOut() , and if the IP requests too quickly, all expired timeouts will be deleted. A double hit view for a DoS hacker. They get another page, and page generation can be slowed down through deleteExpiredRequests() if there are a large number of expired.
Edit two: This is more or less what I would use. I would write the full code, but I program in PHP.
bool function humanRequest(){ // decide if the request lag is humanistic or bot speed // for example: last_request > this_request - 500; } if(!humanRequest()){ // redirect to a Captcha page or die with a warning or something (like SO does) } uid = getUsername(username); if(uid > 0){ // validated request } else{ // increase attempts // you could have a separate column for IP requests or whatever // lock out username after 3 attempts }
You could put humanRequest() in both cases of validating the username. Basically, if they ask for a username in a short period of time, black list them. But if you check the usernames on a special page (which is only included when someone tries to log in), this will already take care of this.
Thus, you only need to add another table. There is no need to modify the table you have.
Jason
source share