CVE-2019-5421: Devise Devise Time-of-check Time-of-use Race Condition Vulnerability
MODERATECVE-2019-5421 is a MODERATE devise time-of-check time-of-use race condition vulnerability (CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition) affecting Devise libraries in the RubyGems ecosystem. The issue involves devise time-of-check time-of-use race condition vulnerability. Remediation is available by upgrading affected packages to version 4.6.0.
CVE-2019-5421 at a Glance
How to Fix CVE-2019-5421
To remediate this vulnerability, upgrade all affected Devise 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 to 4.6.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for devise
How to Check if You Are Affected
To determine whether your application is affected by CVE-2019-5421, inspect your project dependencies for Devise:
inspect dependencies for devise
Analyze the terminal output to locate any version of Devise in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.6.0), 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 CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition, where the product checks the state of a resource before using that resource, but the resource's state can change between the check and the use in a way that invalidates the results of the check. In Devise, 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-2019-5421 Affected Devise Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
devise
|
RubyGems |
< 4.6.0
|
4.6.0
|
References
Frequently Asked Questions
What is CVE-2019-5421?
Which Devise versions are affected?
What version fixes CVE-2019-5421?
Is devise affected?
What CWE is associated with CVE-2019-5421?
How can I check RubyGems dependencies for CVE-2019-5421?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-73rf-6mrf-759q",
"modified" : "2023-01-23T20:46:50Z",
"published" : "2019-03-19T18:03:25Z",
"aliases" : [ "CVE-2019-5421" ],
"summary" : "devise Time-of-check Time-of-use Race Condition vulnerability",
"details" : "Devise ruby gem before 4.6.0 when the `lockable` module is used is vulnerable to a time-of-check time-of-use (TOCTOU) race condition due to `increment_failed_attempts` within the `Devise::Models::Lockable` class not being concurrency safe.",
"severity" : [ ],
"affected" : [ {
"package" : {
"ecosystem" : "RubyGems",
"name" : "devise"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.6.0"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2019-5421"
}, {
"type" : "WEB",
"url" : "https://github.com/plataformatec/devise/issues/4981"
}, {
"type" : "WEB",
"url" : "https://github.com/plataformatec/devise/pull/4996"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/plataformatec/devise"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-367" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2020-06-16T21:21:17Z",
"nvd_published_at" : null
}
}