CVE-2021-41580: Passport oauth2 Improper Access Control Vulnerability
MODERATECVE-2021-41580 is a MODERATE (CVSS 5.3) improper access control vulnerability (CWE-287: Improper Authentication) affecting Passport oauth2 libraries in the npm ecosystem. The issue involves improper access control in passport-oauth2. Remediation is available by upgrading affected packages to version 1.6.1.
CVE-2021-41580 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:L/PR:N/UI:N/S:U/C:L/I:N/A:N).
How to Fix CVE-2021-41580
To remediate this vulnerability, upgrade all affected Passport oauth2 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install passport-oauth2@1.6.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls passport-oauth2
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2021-41580, inspect your project dependencies using npm:
npm ls passport-oauth2
Analyze the terminal output to locate any version of Passport oauth2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.6.1), your application is affected.
Note: The npm ls passport-oauth2 command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-287: Improper Authentication, where when an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct. In Passport oauth2, 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-41580 Affected Passport oauth2 Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
passport-oauth2
|
npm |
< 1.6.1
|
1.6.1
|
References
Frequently Asked Questions
What is CVE-2021-41580?
Which Passport oauth2 versions are affected?
What version fixes CVE-2021-41580?
Is passport-oauth2 affected?
What is the CVSS score of CVE-2021-41580?
What CWE is associated with CVE-2021-41580?
How can I check npm dependencies for CVE-2021-41580?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-f794-r6xc-hf3v",
"modified" : "2021-10-06T13:23:09Z",
"published" : "2021-09-29T17:18:32Z",
"aliases" : [ "CVE-2021-41580" ],
"summary" : "Improper Access Control in passport-oauth2",
"details" : "The passport-oauth2 package before 1.6.1 for Node.js mishandles the error condition of failure to obtain an access token. This is exploitable in certain use cases where an OAuth identity provider uses an HTTP 200 status code for authentication-failure error reports, and an application grants authorization upon simply receiving the access token (i.e., does not try to use the token). NOTE: the passport-oauth2 vendor does not consider this a passport-oauth2 vulnerability.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "passport-oauth2"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.6.1"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-41580"
}, {
"type" : "WEB",
"url" : "https://github.com/jaredhanson/passport-oauth2/pull/144"
}, {
"type" : "WEB",
"url" : "https://github.com/jaredhanson/passport-oauth2/commit/8e3bcdff145a2219033bd782fc517229fe3e05ea"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/jaredhanson/passport-oauth2"
}, {
"type" : "WEB",
"url" : "https://github.com/jaredhanson/passport-oauth2/compare/v1.6.0...v1.6.1"
}, {
"type" : "WEB",
"url" : "https://medium.com/passportjs/no-access-token-no-service-7fb017c9e262"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-287" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2021-09-28T21:14:20Z",
"nvd_published_at" : "2021-09-27T07:15:00Z"
}
}