CVE-2021-41580: Improper Access Control in passport-oauth2

passport-oauth2 Updated 02 Oct 2025

Summary

29/09/2021
Yes i
Moderate
5.3

CVE-2021-41580: Improper Access Control in passport-oauth2. Affects passport-oauth2 versions < 1.6.1. Fixed in 1.6.1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

The passport-oauth2 package is a popular npm package used in Node.js applications for implementing OAuth 2.0 authentication. It provides a simple and convenient way to integrate OAuth 2.0 identity providers into applications. The package allows users to authenticate with various OAuth providers and obtain access tokens for authorization. However, prior to version 1.6.1, the package had an improper access control vulnerability that could be exploited in certain scenarios.

Vulnerability Detail

The vulnerability in passport-oauth2 arises from a mishandling of the error condition when failing to obtain an access token. In some cases, OAuth identity providers use an HTTP 200 status code to indicate authentication failure. However, the passport-oauth2 package does not properly handle this error condition. As a result, an application using this package may grant authorization based solely on the receipt of an access token, without verifying its validity. This can lead to unauthorized access and potential security breaches. It's important to note that the passport-oauth2 vendor does not consider this vulnerability a passport-oauth2 issue.

How To Fix

Minimum fixed version

1.6.1

This is the first release that contains the fix.

npm install passport-oauth2@1.6.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There is no specific workaround mentioned for this vulnerability. However, developers can mitigate the risk by manually verifying the validity of the access token before granting authorization. This can be done by making a request to the OAuth identity provider's token validation endpoint and checking the response for a valid authentication status.

Conclusion

The improper access control vulnerability in the passport-oauth2 package can lead to unauthorized access and potential security breaches. It is crucial for developers to update to version 1.6.1 or later to fix this vulnerability. Additionally, manual verification of access tokens can help mitigate the risk. For further support on vulnerability remediation, you can reach out to DevNack.com.

See every vulnerability recorded for passport-oauth2 →

Share this vulnerability

FAQ

The vulnerability can potentially allow unauthorized access to protected resources in an application that uses the passport-oauth2 package. This can lead to data breaches, privilege escalation, and other security issues.

Versions prior to 1.6.1 of the passport-oauth2 package are affected by this vulnerability.

There is no known exploit for this vulnerability at the moment. However, it is recommended to update to the latest version of the package to mitigate the risk.

There are alternative OAuth 2.0 packages available for Node.js, such as passport-oauth and oauth2orize. Developers can consider using these packages as alternatives to passport-oauth2.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Minimum fixed version

1.6.1

This is the first release that contains the fix.

npm install passport-oauth2@1.6.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback