CVE-2021-43177: Devise two factor Improper One Time Password Handling Vulnerability
MODERATECVE-2021-43177 is a MODERATE (CVSS 5.3) improper one time password handling vulnerability (General Security Weakness) affecting Devise two factor libraries in the RubyGems ecosystem. The issue involves improper one time password handling in devise-two-factor. Remediation is available by upgrading affected packages to version 4.0.2.
CVE-2021-43177 at a Glance
Security Impact
CVSS: 5.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:N/A:N).
How to Fix CVE-2021-43177
To remediate this vulnerability, upgrade all affected Devise two factor dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade devise-two-factor to 4.0.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for devise-two-factor
How to Check if You Are Affected
To determine whether your application is affected by CVE-2021-43177, inspect your project dependencies for Devise two factor:
inspect dependencies for devise-two-factor
Analyze the terminal output to locate any version of Devise two factor in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.0.2), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under General Security Weakness. In Devise two factor, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2021-43177 Affected Devise two factor Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
devise-two-factor
|
RubyGems |
< 4.0.2
|
4.0.2
|
References
Frequently Asked Questions
What is CVE-2021-43177?
Which Devise two factor versions are affected?
What version fixes CVE-2021-43177?
Is devise-two-factor affected?
What is the CVSS score of CVE-2021-43177?
What CWE is associated with CVE-2021-43177?
How can I check RubyGems dependencies for CVE-2021-43177?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-jm35-h8q2-73mp",
"modified" : "2023-05-04T19:31:11Z",
"published" : "2022-04-07T22:09:03Z",
"aliases" : [ "CVE-2021-43177" ],
"summary" : "Improper one time password handling in devise-two-factor",
"details" : "### Impact\nAs 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.\n \n### Patches\nThis vulnerability has been patched in version 4.0.2 which was released on March 24th, 2022. Individuals using this package are strongly encouraged to upgrade as soon as possible.\n\n### Credit for discovery\nBenoit Côté-Jodoin\nMichael Nipper - https://github.com/tinfoil/devise-two-factor/issues/106",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "RubyGems",
"name" : "devise-two-factor"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.0.2"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/tinfoil/devise-two-factor/security/advisories/GHSA-jm35-h8q2-73mp"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-43177"
}, {
"type" : "WEB",
"url" : "https://github.com/tinfoil/devise-two-factor/issues/106"
}, {
"type" : "WEB",
"url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/devise-two-factor/CVE-2021-43177.yml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/tinfoil/devise-two-factor"
} ],
"database_specific" : {
"cwe_ids" : [ ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2022-04-07T22:09:03Z",
"nvd_published_at" : "2022-04-11T20:15:00Z"
}
}