Description
@fastify/oauth2 is a Fastify wrapper for OAuth2 login flows. In versions 7.2.0 through 8.3.1, the state and code-verifier cookies are set without a Path attribute at a login route with two or more path segments, while the clearing step at the OAuth callback writes them with a root path, so the original cookies survive the callback and the documented single-use guarantee for the state value does not hold. A state value an attacker learns stays valid for the rest of the browser session, letting the attacker drive their own authorization flow in the victim's browser and sign the victim in to the attacker's account (login CSRF). The issue is fixed in @fastify/oauth2 8.3.2, and users should upgrade to 8.3.2 or later. As a workaround, set an explicit cookie path so the set and the clear name the same cookie.
Published: 2026-10-19
Score: 4.2 Medium
EPSS: n/a
KEV: No
Impact: Login CSRF via OAuth state cookie
Action: Upgrade Now
AI Analysis

Impact

When a user initiates an OAuth2 login flow, @fastify/oauth2 sets the state and code‑verifier tokens as cookies without a Path attribute if the login endpoint has two or more segments. During the callback, the library clears these cookies using a root path. Because the original cookies lack a defined path, the clearing operation does not match them and the state cookie remains in the browser for the rest of the session. The state value is meant to be single‑use; by remaining valid, it can be captured by an attacker and reused to force the victim’s browser to authenticate as the attacker’s account, constituting a login‑CSRF attack. The flaw involves improper path handling (CWE‑459) and accidental exposure of sensitive cookie contents (CWE‑613) in addition to the core CSRF weakness (CWE‑352).

Affected Systems

The vulnerable component is the @fastify/oauth2 Fastify wrapper for OAuth2 login flows. All releases from version 7.2.0 up to and including 8.3.1 are affected. The issue was resolved in version 8.3.2, where the cookie path is correctly applied during both creation and deletion. Users of any affected version should update to 8.3.2 or later, or apply the workaround described below.

Risk and Exploitability

The CVSS score of 4.2 indicates a moderate impact. An EPSS score is not available and the vulnerability is not listed in the CISA KEV catalog, suggesting limited evidence of exploitation. Based on the description, it is inferred that the attacker must convince the victim to initiate or complete an OAuth flow, such as through phishing or a malicious link, to capture a valid state value. This requires user interaction and does not provide a pure remote code‑execution vector, so the overall risk is lower than high‑severity remote exploits, yet the flaw enables unauthorized account access without user consent.

Generated by OpenCVE AI on October 19, 2026 at 15:53 UTC.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade @fastify/oauth2 to version 8.3.2 or later
  • Configure the OAuth state and code‑verifier cookies to use an explicit Path attribute for both set and clear operations so the same Path is applied
  • Set the SameSite attribute of these cookies to "Strict" or "Lax" to reduce the likelihood of cross‑site request forgery

Generated by OpenCVE AI on October 19, 2026 at 15:53 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Mon, 19 Oct 2026 15:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Mon, 19 Oct 2026 13:30:00 +0000

Type Values Removed Values Added
Description @fastify/oauth2 is a Fastify wrapper for OAuth2 login flows. In versions 7.2.0 through 8.3.1, the state and code-verifier cookies are set without a Path attribute at a login route with two or more path segments, while the clearing step at the OAuth callback writes them with a root path, so the original cookies survive the callback and the documented single-use guarantee for the state value does not hold. A state value an attacker learns stays valid for the rest of the browser session, letting the attacker drive their own authorization flow in the victim's browser and sign the victim in to the attacker's account (login CSRF). The issue is fixed in @fastify/oauth2 8.3.2, and users should upgrade to 8.3.2 or later. As a workaround, set an explicit cookie path so the set and the clear name the same cookie.
Title @fastify/oauth2 vulnerable to Login CSRF via OAuth state cookie not cleared after callback
Weaknesses CWE-352
CWE-459
CWE-613
References
Metrics cvssV3_1

{'score': 4.2, 'vector': 'CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:N'}


Subscriptions

No data.

cve-icon MITRE

Status: PUBLISHED

Assigner: openjs

Published:

Updated: 2026-10-19T14:26:45.991Z

Reserved: 2026-10-13T14:13:40.147Z

Link: CVE-2026-110008

cve-icon Vulnrichment

Updated: 2026-10-19T14:26:41.667Z

cve-icon NVD

Status : Received

Published: 2026-10-19T14:16:57.527

Modified: 2026-10-19T15:16:54.450

Link: CVE-2026-110008

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-10-19T16:00:15Z

Weaknesses
  • CWE-352

    Cross-Site Request Forgery (CSRF)

  • CWE-459

    Incomplete Cleanup

  • CWE-613

    Insufficient Session Expiration