{"id":"CVE-2024-8796","published":"2024-09-17T17:12:13Z","modified":"2024-09-20T19:43:21Z","title":"Insufficient Default OTP Shared Secret Length","vendor":"devise-two-factor","product":"devise-two-factor","tier":"tail","description":{"text":"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.","provenance":"source","from":"CVE.org"},"cvss":{"score":5.3,"severity":"MEDIUM","version":"3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:N/A:N","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00641,"percentile":0.5164,"provenance":"source"},"cwes":[{"id":"CWE-331","name":"Insufficient Entropy"}],"references":[{"url":"https://github.com/devise-two-factor/devise-two-factor/security/advisories/GHSA-qjxf-mc72-wjr2","tags":["vendor-advisory"]}],"priority":{"score":14.0,"factors":[{"name":"EPSS percentile","points":10.33},{"name":"CVSS severity","points":3.71}]},"vendorSlug":"devise-two-factor","affectedVersions":[{"vendor":"devise-two-factor","product":"devise-two-factor","versions":[">= 4.0.0, < 6.0.0","1.0.0"]}],"solutions":{"items":["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."],"from":"CVE.org CNA","provenance":"source"},"workarounds":{"items":["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."],"from":"CVE.org CNA","provenance":"source"},"capec":[{"id":"CAPEC-59","name":"Session Credential Falsification through Prediction"}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"partial","timestamp":"2024-09-18T14:00:40.365192Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"RubyGems","package":"devise-two-factor","vulnerableRanges":[">=4.0.0, <6.0.0"],"patched":["6.0.0"],"from":["GHSA-qjxf-mc72-wjr2"],"provenance":"source"}],"summary":{"text":"The devise-two-factor gem, a multi-factor authentication add-on for Devise, generates TOTP shared secrets that are shorter than the 128-bit minimum recommended by RFC 4226 when run under its default configuration. An attacker with network access and low-privileged credentials could exploit this, under high attack complexity, by guessing the shorter secret and generating valid one-time codes for the affected account.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T21:41:37Z"},"euvd":{"id":"EUVD-2024-2856","exploited":false,"provenance":"source"}}