# CVE-2021-43177: Improper one time password handling in devise-two-factor

- Severity: Medium 5.3 (CVSS:3.1, scored by NVD) `CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:N/A:N`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.88%, higher than 60% of CVEs (2026-12-01)
- Published: 2022-04-07T22:09:03.000Z
- Modified: 2026-08-27T03:56:00.293Z
- Also known as: GHSA-jm35-h8q2-73mp
- Weaknesses: CWE-254
- Assigned by: SNPS

## Description

As a result of an incomplete fix for CVE-2015-7225, in versions of devise-two-factor prior to 4.0.2 it is possible to reuse a One-Time-Password (OTP) for one (and only one) immediately trailing interval. CVSS Vector: (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:N/A:N)

(As written by CVE List.)

## Affected

- Tinfoil devise-two-factor: < 4.0.2
- devise-two-factor (RubyGems): before 4.0.2
- tinfoilsecurity devise-two-factor: before 4.0.2

## Every score

- GitHub: CVSS:3.1 5.3 Medium `CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:N/A:N`
- NVD: CVSS:3.1 5.3 Medium `CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:N/A:N`
- NVD: CVSS:2.0 3.5 Low `AV:N/AC:M/Au:S/C:P/I:N/A:N`

## References

- <https://github.com/tinfoil/devise-two-factor/security/advisories/GHSA-jm35-h8q2-73mp> (third-party-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2021-43177> (advisory)
- <https://github.com/tinfoil/devise-two-factor/issues/106> (web)
- <https://github.com/rubysec/ruby-advisory-db/blob/master/gems/devise-two-factor/CVE-2021-43177.yml> (web)
- <https://github.com/tinfoil/devise-two-factor> (package)

## Sources

- CVE List: [CVE-2021-43177](https://www.cve.org/CVERecord?id=CVE-2021-43177), CVE Terms of Use, modified 2024-08-04
- GitHub Advisory Database: [GHSA-jm35-h8q2-73mp](https://github.com/advisories/GHSA-jm35-h8q2-73mp), CC-BY-4.0, modified 2026-08-27
- NVD: [CVE-2021-43177](https://nvd.nist.gov/vuln/detail/CVE-2021-43177), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2021-43177 · Whole record: https://cve.day/CVE-2021-43177.json · Rebuilt by cve.day 2026-11-25T22:24:36.864Z
