CVEfocus › CVE database › CVE-2024-8796

CVE-2024-8796Insufficient Default OTP Shared Secret Length

CVSS 5.3 MediumEPSS 0.7% (higher than 48% of CVEs)Published 2024-09-17Updated 2024-09-20Assigner: SNPS

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.

CWE-331

What to do

Fixed builds are available from RubyGems: see the table below for the fixed version per release.

Debian, Ubuntu have not shipped a fix for every release yet.

Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.

curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \
  -H "Content-Type: text/plain" --data-binary @inventory.txt

Vendor status at a glance

1Fixed
4Fix pending
1Not affected

Status by vendor and release

From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.

ReleasePackageStatusFixed versionAdvisory
Ubuntu 24.04ruby-devise-two-factorNot affected
vulnerable_code_not_present
Ubuntu 22.04ruby-devise-two-factorFix pending4.0.0-2ubuntu0.1~esm1 (Ubuntu Pro)UBUNTU-CVE-2024-8796
Ubuntu 20.04ruby-devise-two-factorFix pending3.1.0-2ubuntu0.1~esm1 (Ubuntu Pro)UBUNTU-CVE-2024-8796
Ubuntu 16.04ruby-devise-two-factorFix pendingUBUNTU-CVE-2024-8796
Debian 12ruby-devise-two-factorFix pendingDEBIAN-CVE-2024-8796
RubyGems librarydevise-two-factorFixed6.0.0GHSA-qjxf-mc72-wjr2

What the vendor says

As published in the CVE record by SNPS, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.

Solution: 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.

Workaround: 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.

Vendor advisories:

References

About this page

Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.