GHSA-chcr-x7hc-8fp8

Suggest an improvement
Source
https://github.com/advisories/GHSA-chcr-x7hc-8fp8
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2024/01/GHSA-chcr-x7hc-8fp8/GHSA-chcr-x7hc-8fp8.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-chcr-x7hc-8fp8
Withdrawn
2024-03-19T22:33:55Z
Published
2024-01-12T15:13:05Z
Modified
2024-03-20T15:46:00.075243Z
Severity
  • CVSS_V3 - CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:L
Summary
Devise-Two-Factor vulnerable to brute force attacks
Details

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.
  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) and Chris MacNaughton (Centauri Solutions)

References

Affected packages

RubyGems / devise-two-factor

Package

Name
devise-two-factor
Purl
pkg:gem/devise-two-factor

Affected ranges

Type
ECOSYSTEM
Events
Introduced
1.0.0
Last affected
5.0.0

Affected versions

1.*

1.0.0
1.0.1
1.0.2
1.1.0

2.*

2.0.0
2.0.1
2.1.0
2.2.0
2.2.1

3.*

3.0.0
3.0.1
3.0.2
3.0.3
3.1.0

4.*

4.0.0
4.0.1
4.0.2
4.1.0
4.1.1

5.*

5.0.0