# GHSA-CHCR-X7HC-8FP8: Devise-Two-Factor vulnerable to brute force attacks

- Database: GitHub
- Status: withdrawn
- Severity: CVSS 5.0 (Medium)
- Published: 2024-01-12
- Modified: 2026-09-10

## Tracked as

- [CVE-2024-0227](https://cve.now/CVE-2024-0227.md): CVE-2024-0227

## Description

### 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

1. Use the `lockable` strategy 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.
2. Configure a rate limit for your application, especially on the endpoints used to log in. One such library to accomplish this is [rack-attack](https://rubygems.org/gems/rack-attack).
3. 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](https://www.radicallyopensecurity.com/)) and Chris MacNaughton ([Centauri Solutions](https://centauri.solutions))

## References

- https://github.com/devise-two-factor/devise-two-factor/security/advisories/GHSA-chcr-x7hc-8fp8
- https://nvd.nist.gov/vuln/detail/CVE-2024-0227
- https://github.com/devise-two-factor/devise-two-factor
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/devise-two-factor/CVE-2024-0227.yml

Page: https://cve.now/GHSA-CHCR-X7HC-8FP8

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
