CVE-2024-0227: Devise-Two-Factor vulnerable to brute force attacks
This advisory was withdrawn on Mar 19, 2024. The publisher no longer considers it a valid vulnerability.
Advisory withdrawn The backing CVE has been rejected Devise-Two-Factor does not throttle or otherwise restrict login attempts at the server by default. When combined with the Time-based One Time Password algorithm's (TOTP) inherent entropy limitations, it's possible for an attacker to bypass the 2FA mechanism through brute-force attacks.
Published Jan 12, 2024 · Updated Mar 20, 2024
Affected packages
devise-two-factor
- Ecosystem
- RubyGems
- Affected
- >= 1.0.0, <= 5.0.0
- Fixed in
- No patched version yet
- Check
bundle info devise-two-factor
Advisory details
From the GitHub Advisory Database (CC BY 4.0).
Advisory withdrawn
The backing CVE has been rejected
Devise-Two-Factor does not throttle or otherwise restrict login attempts at the server by default. When combined with the Time-based One Time Password algorithm's (TOTP) inherent entropy limitations, it's possible for an attacker to bypass the 2FA mechanism through brute-force attacks.
Impact
If a user's username and password have already been compromised an attacker would be able to try possible TOTP codes and see if they can hit a lucky collision to log in as that user. The user under attack would not necessarily know that their account has been compromised.
Patches
Devise-Two-Factor has not released any fixes for this vulnerability. This library is open-ended by design and cannot solve this for all applications natively. It's recommended that any application leveraging Devise-Two-Factor implement controls at the application level to mitigate this threat. A non-exhaustive list of possible mitigations can be found below.
Mitigations
- Use the
lockablestrategy from Devise to lock a user after a certain number of failed login attempts. See https://www.rubydoc.info/github/heartcombo/devise/main/Devise/Models/Lockable for more information. - Configure a rate limit for your application, especially on the endpoints used to log in. One such library to accomplish this is rack-attack.
- When displaying authentication errors hide whether validating a username/password combination failed or a two-factor code failed behind a more generic error message.
Acknowledgements
Christian Reitter (Radically Open Security) and Chris MacNaughton (Centauri Solutions)
Credited to bsedat.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology
