CVE-2021-41580: Passport oauth2 Improper Access Control Vulnerability

MODERATE
Advisory Identifier: GHSA-f794-r6xc-hf3v
CVSS 5.3
CWE-287
Published
Advisory Summary

CVE-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

CVE Identifier CVE-2021-41580
GHSA Identifier GHSA-f794-r6xc-hf3v
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-287: Improper Authentication
Affected Product Passport oauth2
Package Ecosystem npm
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (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.

passport-oauth2 fixed: 1.6.1
npm install passport-oauth2@1.6.1
Verify Direct and Transitive Dependencies

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

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.

CVE-2021-41580 Affected Passport oauth2 Versions

1 component(s)
Fixed Versions:
1.6.1
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?
CVE-2021-41580 is a security vulnerability in Passport oauth2 involving Improper Access Control in passport-oauth2 under CWE-287: Improper Authentication.
Which Passport oauth2 versions are affected?
Affected versions include releases prior to 1.6.1 across affected packages: passport-oauth2.
What version fixes CVE-2021-41580?
Upgrading to 1.6.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is passport-oauth2 affected?
Yes, passport-oauth2 is affected in releases prior to 1.6.1. Upgrade your dependency to 1.6.1 or later.
What is the CVSS score of CVE-2021-41580?
CVE-2021-41580 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2021-41580?
CVE-2021-41580 is classified under CWE-287: Improper Authentication (When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.).
How can I check npm dependencies for CVE-2021-41580?
Run the dependency tree command: 'npm ls passport-oauth2'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}