Skip to content

Commit 5e77a68

Browse files
jasnowpostmodern
authored andcommitted
GHSA SYNC: 1 brand new advisory
1 parent 2780bcd commit 5e77a68

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
gem: devise-two-factor
3+
cve: 2024-8796
4+
ghsa: qjxf-mc72-wjr2
5+
url: https://github.com/devise-two-factor/devise-two-factor/security/advisories/GHSA-qjxf-mc72-wjr2
6+
title: Devise-Two-Factor Authentication Uses Insufficient Default
7+
OTP Shared Secret Length
8+
date: 2024-09-17
9+
description: |
10+
### Summary
11+
Under the default configuration, Devise-Two-Factor version
12+
>= 2.2.0 & < 6.0.0 generate TOTP shared secrets that are 120 bits
13+
instead of the 128-bit minimum defined by
14+
[RFC 4226](https://datatracker.ietf.org/doc/html/rfc4226).
15+
Using a shared secret shorter than the minimum to generate a
16+
multi-factor authentication code could make it easier for an
17+
attacker to guess the shared secret and generate valid TOTP codes.
18+
19+
### Remediation
20+
Devise-Two-Factor should be upgraded to version v6.0.0 as soon
21+
as possible. After upgrading, the length of shared secrets and
22+
TOTP URLs generated by the library will increase since the new
23+
shared secrets will be longer.
24+
25+
If upgrading is not possible, you can override the default
26+
`otp_secret_length` attribute in the model when configuring
27+
`two_factor_authenticable` and set it to a value of at least
28+
26 to ensure newly generated shared secrets are at least
29+
128-bits long.
30+
31+
After upgrading or implementing the workaround, applications
32+
using Devise-Two-Factor may wish to migrate users to the new
33+
OTP length to provide increased protection for those accounts.
34+
Turning off OTP for users by setting `otp_required_for_login`
35+
to false is not recommended since it would leave accounts
36+
unprotected. However, you may wish to implement application
37+
logic that checks the length of a user's shared secret and
38+
prompts users to re-enroll in OTP.
39+
40+
### Background
41+
Devise-Two-Factor uses [ROTP](https://github.com/mdp/rotp) to
42+
generate shared secrets for TOTP. In ROTP < 5.0.0, the first
43+
argument to the "ROTP::Base32#random_base32" function represented
44+
the number of bytes to read from SecureRandom which were then
45+
returned as a base32-encoded string. In ROTP 5.1.0, this function
46+
was changed so that the first argument now represents the length
47+
of the base32-encoded string returned by the function instead
48+
of the number of bytes to read from SecureRandom resulting in
49+
a shorter key being generated for the same input value.
50+
(https://github.com/mdp/rotp/commit/c6c24ab894e7c2b1579d45ac82c41454d1e98227).
51+
cvss_v3: 5.3
52+
cvss_v4: 6.0
53+
unaffected_versions:
54+
- "< 2.2.0"
55+
patched_versions:
56+
- ">= 6.0.0"
57+
related:
58+
url:
59+
- https://nvd.nist.gov/vuln/detail/CVE-2024-8796
60+
- https://github.com/devise-two-factor/devise-two-factor/security/advisories/GHSA-qjxf-mc72-wjr2
61+
- https://github.com/devise-two-factor/devise-two-factor/commit/cc6f34423d9c6af9f3e02be478c3c40dc7462e19
62+
- https://github.com/advisories/GHSA-qjxf-mc72-wjr2

0 commit comments

Comments
 (0)