Home / devise-two-factor / devise-two-factor / CVE-2024-8796
CVE-2024-8796: is it exploited, and which versions of devise-two-factor are affected and fixed?
CVE-2024-8796 is an insufficient Entropy vulnerability in devise-two-factor. It is not known to be exploited: it is not in CISA's Known Exploited Vulnerabilities catalog (catalog 2026.11.30, read December 3, 2026, 11:38 UTC). Affected: devise-two-factor from 4.0.0 before 6.0.0 (GitHub advisory GHSA-qjxf-mc72-wjr2). Fixed in 6.0.0 (GitHub advisory GHSA-qjxf-mc72-wjr2). Severity: Medium (6.0, CVSS 4.0, from SNPS).
Data checked December 3, 2026: last read CISA KEV December 3, 2026, 11:38 UTC, CVE record November 19, 2026, 07:12 UTC and NVD November 19, 2026, 07:26 UTC.
What is CVE-2024-8796?
Insufficient Default OTP Shared Secret Length
Under the default configuration, Devise-Two-Factor versions >= 2.2.0 & < 6.0.0 generate TOTP shared secrets that are 120 bits instead of the 128-bit minimum defined by RFC 4226. Using a shared secret shorter than the minimum to generate a multi-factor authentication code could make it easier for an attacker to guess the shared secret and generate valid TOTP codes.
From the CVE record by SNPS, last updated September 20, 2024, 19:43 UTC.
Which versions are affected, and which fix it?
| Vendor | Product | Affected | Fixed or not affected from |
|---|---|---|---|
| devise-two-factor | devise-two-factor | from 4.0.0 before 6.0.0 1.0.0 | 6.0.0 |
As the CVE record by SNPS states it, last updated September 20, 2024. Version ranges are the CNA's; a version the record calls not affected is usually the fix.
Which packages are affected, and in which version is each fixed?
| Ecosystem | Package | Affected | Fixed in | Advisory |
|---|---|---|---|---|
| RubyGems | devise-two-factor | >= 4.0.0, < 6.0.0 | 6.0.0 | GHSA-qjxf-mc72-wjr2 |
| RubyGems | devise-two-factor | 1.0.0 | none listed | GHSA-qjxf-mc72-wjr2 |
GitHub Advisory Database, reviewed advisories (CC BY 4.0); advisory updated September 20, 2024. Summary: Devise-Two-Factor Authentication Uses Insufficient Default OTP Shared Secret Length.
Which products and versions does the NVD list as affected?
| Vendor | Product | Versions | Type |
|---|---|---|---|
| tinfoilsecurity | devise-two-factor | from 4.0.0 before 6.0.0 | application |
| tinfoilsecurity | devise-two-factor | 1.0.0 | application |
NVD analysis (status Analyzed), last modified June 17, 2026, 08:23 UTC.
How severe is CVE-2024-8796?
| Score | Version | Vector | Source |
|---|---|---|---|
| Medium 6.0 | CVSS 4.0 | CVSS:4.0/AV:N/AC:H/AT:P/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N | SNPS |
| Medium 5.3 | CVSS 3.1 | CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:N/A:N | SNPS |
| Medium 5.3 | CVSS 3.1 | CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:N/A:N | NVD |
Each score is shown as its source gave it: the CNA that wrote the record, CISA's ADP (vulnrichment) and the NVD. They can differ.
What the ratings mean: in CVSS 3 and 4, scores run from 0 to 10, with Low 0.1 to 3.9, Medium 4.0 to 6.9, High 7.0 to 8.9 and Critical 9.0 to 10.0. CVSS 2 has no Critical band: its High runs from 7.0 to 10.0. The vector lists how the flaw is reached (network, local), what an attacker needs (privileges, a user's click) and what it can harm.
Is CVE-2024-8796 exploited in the wild?
- CISA KEV
- Not listed (catalog 2026.11.30)
- CISA SSVC
- Exploitation: none; automatable: no; technical impact: partial (CISA ADP, September 18, 2024)
- EPSS
- 0.64% probability of exploitation activity in the next 30 days, percentile 52.0 (FIRST EPSS, scores of December 2, 2026)
What kind of flaw is it?
- CWE-331 Insufficient Entropy
How do I fix it? (from the CVE record)
Devise-Two-Factor should be upgraded to version v6.0.0 as soon as possible. After upgrading, the length of shared secrets and TOTP URLs generated by the library will increase since the new shared secrets will be longer. After upgrading or implementing the workaround, applications using Devise-Two-Factor may wish to migrate users to the new OTP length to provide increased protection for those accounts. Turning off OTP for users by setting otp_required_for_login to false is not recommended since it would leave accounts unprotected. However, you may wish to implement application logic that checks the length of a user's shared secret and prompts users to re-enroll in OTP.
Is there a workaround? (from the CVE record)
If upgrading is not possible, you can override the default otp_secret_length attribute in the model when configuring two_factor_authenticable and set it to a value of at least 26 to ensure newly generated shared secrets are at least 128-bits long.
Where are the vendor advisories and references?
- https://github.com/devise-two-factor/devise-two-factor/security/advisories/GHSA-qjxf-mc72-wjr2 vendor-advisory
Who found and reported it?
- Mark Adams (analyst)
- Garrett Rappaport (finder)
As published in the CVE record; contact details are removed.
When was it published, and where is the official record?
- Reserved
- September 13, 2024
- Published
- September 17, 2024, 17:12 UTC
- CVE record updated
- September 20, 2024, 19:43 UTC by SNPS
- NVD
- Analyzed, last modified June 17, 2026, 08:23 UTC
- Last checked
- CVE list November 19, 2026, 07:12 UTC; NVD November 19, 2026, 07:26 UTC; KEV December 3, 2026, 11:38 UTC; EPSS December 2, 2026
- Official record
- cve.org · NVD
Questions about CVE-2024-8796
Is CVE-2024-8796 exploited in the wild?
Not as far as CISA knows: it is not in the Known Exploited Vulnerabilities catalog, read December 3, 2026, 11:38 UTC. FIRST's EPSS gives it a 0.64% chance of exploitation activity in the next 30 days (scores of December 2, 2026).
Which versions of devise-two-factor are affected by CVE-2024-8796?
devise-two-factor from 4.0.0 before 6.0.0, per the GitHub advisory GHSA-qjxf-mc72-wjr2. The tables above give every range the sources list.
Which version fixes CVE-2024-8796?
6.0.0, per the GitHub advisory GHSA-qjxf-mc72-wjr2. Check the vendor's advisory before you rely on it.
How severe is CVE-2024-8796?
Medium (6.0, CVSS 4.0, from SNPS). The severity table above shows each score with its source.
Where is the official record of CVE-2024-8796?
The CVE Program's record is at cve.org and the NVD's at nvd.nist.gov. For a fix, the vendor's own advisory is the one to follow.