-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
brute force vulnerability #231
Comments
extend the account lock for subsequent failed login attempts after the initial lock period
extend the account lock for subsequent failed login attempts after the initial lock period
I could be mistaken, but this sounds like a misunderstanding of how the brute force protection works. My understanding of the functionality, is that if an account receives X invalid login attempts within a certain time frame all login attempts will be blocked until the login_lock_time_period expires. Once that time frame has passed, logins will be allowed as usual unless the bad login count is exceeded again. This process can repeat infinitely, and mainly acts as a way to slow down brute force attempts to the point of in-feasibility, while not overly burdening users. Extending a lockout period if additional bad requests are received during the lockout is not an intended functionality, as far as I'm aware. The hook that returns if it's present on line 68 is intentional, as the |
You misunderstood the point. After the initial login_lock_time_period expires, an infinite number of brute force attempts are allowed without ever considering another login_lock_time_period. This effectively disables the brute force protection after the first login_lock_time_period has passed. It is only enabled back again after a successful login (at which point, the lock_expires_at field is set back to nil). This is clearly a severe vulnerability. |
Inside if !login_unlocked? && config.login_lock_time_period != 0
login_unlock! if send(config.lock_expires_at_attribute_name) <= Time.now.in_time_zone
end
And inside Sorcery's authenticate method:
Edit: Edit 2: That would be the case if it still ran the callbacks, but because it returns early the callback to unlock indeed only gets run after a successful login. Issue confirmed, I'll create security releases and deploy today. |
The authenticate method previously would return before callbacks executed if an invalid password was provided, which causes the brute force protection to only work for the first lockout period, and only resets after a successful login. Fixes Sorcery#231
The authenticate method previously would return before callbacks executed if an invalid password was provided, which causes the brute force protection to only work for the first lockout period, and only resets after a successful login. Fixes #231
@futuretap A security patch has been released ( |
Sorcery 0.14.0 is vulnerable to brute force attacks even if a login_lock_time_period is configured.
If an attacker continues their login attempts after the initial login_lock_time_period has passed, Sorcery no longer rejects those login attempts until eventually the attacker has guessed the right password.
This is caused by an early return in model/submodules/brute_force_protection.rb:68 which skips the update of the
lock_expires_at
field. So failed attempts don't updatelock_expires_at
as long aslock_expires_at
contains any date, even if already passed.I'll provide a fix.
The text was updated successfully, but these errors were encountered: