Welcome Guest, Not a member yet? Register   Sign In
Mitigate brute force attacks on login page
#1

[eluser]novice32[/eluser]
I just wanted to share the below for mitigating brute force attacks, which are often overlooked. Essentially, a valid login will get authenticated quickly, but an invalid will be delayed by 1 second.

Thoughts, anyone? I know you can block an IP after a number of failed attempts, but that seems risky and more complex.

Code:
function _login_valid()
    {

        $email = $this->input->post('email');
        $password = $this->input->post('password');
        if ($this->User_model->login_valid($email, $password) == false)
        {
            sleep(1); //if username and password combo is wrong, sleep for one second
            $this->form_validation->set_message('_login_valid', 'Invalid username and/or password.');
            return false;
        } else
        {
            return true;
        }
    }


Messages In This Thread
Mitigate brute force attacks on login page - by El Forum - 04-19-2012, 08:59 PM
Mitigate brute force attacks on login page - by El Forum - 04-19-2012, 11:47 PM
Mitigate brute force attacks on login page - by El Forum - 04-20-2012, 04:42 AM
Mitigate brute force attacks on login page - by El Forum - 04-20-2012, 05:15 AM
Mitigate brute force attacks on login page - by El Forum - 04-20-2012, 10:26 AM
Mitigate brute force attacks on login page - by El Forum - 04-20-2012, 10:50 AM
Mitigate brute force attacks on login page - by El Forum - 04-20-2012, 10:55 AM
Mitigate brute force attacks on login page - by El Forum - 04-20-2012, 12:11 PM
Mitigate brute force attacks on login page - by El Forum - 04-20-2012, 12:39 PM
Mitigate brute force attacks on login page - by El Forum - 04-20-2012, 03:24 PM
Mitigate brute force attacks on login page - by El Forum - 04-22-2012, 09:40 AM
Mitigate brute force attacks on login page - by El Forum - 04-22-2012, 11:53 AM
Mitigate brute force attacks on login page - by El Forum - 04-22-2012, 12:23 PM
Mitigate brute force attacks on login page - by El Forum - 04-22-2012, 01:09 PM
Mitigate brute force attacks on login page - by El Forum - 04-22-2012, 11:41 PM
Mitigate brute force attacks on login page - by El Forum - 04-23-2012, 02:45 AM
Mitigate brute force attacks on login page - by El Forum - 04-25-2012, 07:34 PM
Mitigate brute force attacks on login page - by El Forum - 04-25-2012, 07:42 PM
Mitigate brute force attacks on login page - by El Forum - 04-25-2012, 07:47 PM



Theme © iAndrew 2016 - Forum software by © MyBB