CVE-2023-29019: @fastify/passport Session Fixation Vulnerability

HIGH
Advisory Identifier: GHSA-4m3m-ppvx-xgw9
CVSS 8.1
CWE-384
Published
Advisory Summary

CVE-2023-29019 is a HIGH (CVSS 8.1) session fixation vulnerability (CWE-384: Session Fixation) affecting @fastify/passport libraries in the npm ecosystem. The issue involves session fixation in fastify-passport. Remediation is available by upgrading affected packages to version 1.1.0, 2.3.0.

CVE-2023-29019 at a Glance

CVE Identifier CVE-2023-29019
GHSA Identifier GHSA-4m3m-ppvx-xgw9
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-384: Session Fixation
Affected Product @fastify/passport
Package Ecosystem npm
Published Date
Last Updated

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:L/PR:N/UI:R/S:U/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2023-29019

To remediate this vulnerability, upgrade all affected @fastify/passport dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

@fastify/passport fixed: 1.1.0
npm install @fastify/passport@1.1.0
@fastify/passport fixed: 2.3.0
npm install @fastify/passport@2.3.0
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 @fastify/passport

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2023-29019, inspect your project dependencies using npm:

npm ls @fastify/passport

Analyze the terminal output to locate any version of @fastify/passport in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.1.0), your application is affected.

Note: The npm ls @fastify/passport 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-384: Session Fixation, where authenticating a user, or otherwise establishing a new user session, without invalidating any existing session identifier gives an attacker the opportunity to steal authenticated sessions. In @fastify/passport, 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

Applications using `@fastify/passport` for user authentication, in combination with `@fastify/session` as the underlying session management mechanism, are vulnerable to [session fixation attacks](https://owasp.org/www-community/attacks/Session_fixation) from network and same-site attackers. ## Details fastify applications rely on the `@fastify/passport` library for user authentication. The login and user validation are performed by the `authenticate` function. When executing this function, the `sessionId` is preserved between the pre-login and the authenticated session. Network and [same-site attackers](https://canitakeyoursubdomain.name/) can hijack the victim's session by tossing a valid `sessionId` cookie in the victim's browser and waiting for the victim to log in on the website. ## Fix As a solution, newer versions of `@fastify/passport` regenerate `sessionId` upon login, preventing the attacker-controlled pre-session cookie from being upgraded to an authenticated session. ## Credits * Pedro Adão (@pedromigueladao), [Instituto Superior Técnico, University of Lisbon](https://tecnico.ulisboa.pt/) * Marco Squarcina (@lavish), [Security & Privacy Research Unit, TU Wien](https://secpriv.wien/)

CVE-2023-29019 Affected @fastify/passport Versions

2 component(s)
Fixed Versions:
1.1.02.3.0
Product / Package Ecosystem Affected Versions Fixed Version
@fastify/passport
npm
< 1.1.0
1.1.0
@fastify/passport
npm
≥ 2.0.0
< 2.3.0
2.3.0

References

Frequently Asked Questions

What is CVE-2023-29019?
CVE-2023-29019 is a security vulnerability in @fastify/passport involving Session fixation in fastify-passport under CWE-384: Session Fixation.
Which @fastify/passport versions are affected?
Affected versions include releases prior to 1.1.0, 2.3.0 across affected packages: @fastify/passport.
What version fixes CVE-2023-29019?
Upgrading to 1.1.0, 2.3.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @fastify/passport affected?
Yes, @fastify/passport is affected in releases prior to 1.1.0, 2.3.0. Upgrade your dependency to 1.1.0, 2.3.0 or later.
What is the CVSS score of CVE-2023-29019?
CVE-2023-29019 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2023-29019?
CVE-2023-29019 is classified under CWE-384: Session Fixation (Authenticating a user, or otherwise establishing a new user session, without invalidating any existing session identifier gives an attacker the opportunity to steal authenticated sessions.).
How can I check npm dependencies for CVE-2023-29019?
Run the dependency tree command: 'npm ls @fastify/passport'. 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-4m3m-ppvx-xgw9",
  "modified" : "2023-04-24T15:56:25Z",
  "published" : "2023-04-21T22:33:30Z",
  "aliases" : [ "CVE-2023-29019" ],
  "summary" : "Session fixation in fastify-passport",
  "details" : "Applications using `@fastify/passport` for user authentication, in combination with `@fastify/session` as the underlying session management mechanism, are vulnerable to [session fixation attacks](https://owasp.org/www-community/attacks/Session_fixation) from network and same-site attackers.\n\n## Details\nfastify applications rely on the `@fastify/passport` library for user authentication. The login and user validation are performed by the `authenticate` function. When executing this function, the `sessionId` is preserved between the pre-login and the authenticated session. Network and [same-site attackers](https://canitakeyoursubdomain.name/) can hijack the victim's session by tossing a valid `sessionId` cookie in the victim's browser and waiting for the victim to log in on the website.\n\n## Fix\nAs a solution, newer versions of `@fastify/passport` regenerate `sessionId` upon login, preventing the attacker-controlled pre-session cookie from being upgraded to an authenticated session.\n\n## Credits\n* Pedro Adão (@pedromigueladao), [Instituto Superior Técnico, University of Lisbon](https://tecnico.ulisboa.pt/)\n* Marco Squarcina (@lavish), [Security & Privacy Research Unit, TU Wien](https://secpriv.wien/)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@fastify/passport"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.1.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@fastify/passport"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.3.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/fastify/fastify-passport/security/advisories/GHSA-4m3m-ppvx-xgw9"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-29019"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/fastify/fastify-passport/commit/43c82c321db58ea3e375dd475de60befbfcf2a11"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/fastify/fastify-passport"
  }, {
    "type" : "WEB",
    "url" : "https://owasp.org/www-community/attacks/Session_fixation"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-384" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-04-21T22:33:30Z",
    "nvd_published_at" : "2023-04-21T23:15:20Z"
  }
}