CVE-2021-28680: Devise masquerade Improper Privilege Management Vulnerability
HIGHCVE-2021-28680 is a HIGH (CVSS 8.1) improper privilege management vulnerability (CWE-269: Improper Privilege Management) affecting Devise masquerade libraries in the RubyGems ecosystem. The issue involves improper privilege management in devise_masquerade. Remediation is available by upgrading affected packages to version 1.3.1.
CVE-2021-28680 at a Glance
Security Impact
CVSS: 8.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2021-28680
To remediate this vulnerability, upgrade all affected Devise masquerade 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_masquerade to 1.3.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for devise_masquerade
How to Check if You Are Affected
To determine whether your application is affected by CVE-2021-28680, inspect your project dependencies for Devise masquerade:
inspect dependencies for devise_masquerade
Analyze the terminal output to locate any version of Devise masquerade in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.3.1), 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-269: Improper Privilege Management, where the product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor. In Devise masquerade, 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-28680 Affected Devise masquerade Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
devise_masquerade
|
RubyGems |
< 1.3.1
|
1.3.1
|
References
Frequently Asked Questions
What is CVE-2021-28680?
Which Devise masquerade versions are affected?
What version fixes CVE-2021-28680?
Is devise_masquerade affected?
What is the CVSS score of CVE-2021-28680?
What CWE is associated with CVE-2021-28680?
How can I check RubyGems dependencies for CVE-2021-28680?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-25f5-gc4h-hc22",
"modified" : "2023-09-05T21:51:12Z",
"published" : "2021-12-08T19:55:30Z",
"aliases" : [ "CVE-2021-28680" ],
"summary" : "Improper Privilege Management in devise_masquerade",
"details" : "The devise_masquerade gem before 1.3 allows certain attacks when a password's salt is unknown. An application that uses this gem to let administrators masquerade/impersonate users loses one layer of security protection compared to a situation where Devise (without this extension) is used. If the server-side `secret_key_base` value became publicly known (for instance if it is committed to a public repository by mistake), there are still other protections in place that prevent an attacker from impersonating any user on the site. When masquerading is not used in a plain Devise application, one must know the password salt of the target user if one wants to encrypt and sign a valid session cookie. When `devise_masquerade` is used, however, an attacker can decide which user the \"back\" action will go back to without knowing that user's password salt and simply knowing the user ID, by manipulating the session cookie and pretending that a user is already masqueraded by an administrator.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "RubyGems",
"name" : "devise_masquerade"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.3.1"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-28680"
}, {
"type" : "WEB",
"url" : "https://github.com/oivoodoo/devise_masquerade/issues/83"
}, {
"type" : "WEB",
"url" : "https://github.com/oivoodoo/devise_masquerade/pull/76"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/oivoodoo/devise_masquerade"
}, {
"type" : "WEB",
"url" : "https://github.com/oivoodoo/devise_masquerade/releases/tag/v1.3.1"
}, {
"type" : "WEB",
"url" : "https://labanskoller.se/blog/2021/03/23/the-devise-extension-that-peeled-off-one-layer-of-the-security-onion-cve-2021-28680"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-269" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2021-12-08T19:36:08Z",
"nvd_published_at" : "2021-12-07T21:15:00Z"
}
}