Skip to main content

@fastify/oauth2 CVE-2026-18165

| EUVDEUVD-2026-59767 MEDIUM
Cross-Site Request Forgery (CSRF) (CWE-352)
2026-08-15 ce714d77-add3-4f53-aff5-83d477b104bb
5.4
CVSS 3.1 · NVD
Share

Severity by source

Vendor (ce714d77-add3-4f53-aff5-83d477b104bb) PRIMARY
MEDIUM
qualitative
NVD
5.4 MEDIUM
AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N
vuln.today AI
4.2 MEDIUM

Sibling-subdomain cookie write access required (AC:H); victim must participate in OAuth flow (UI:R); impact limited to session confusion with no victim credential exposure (C:L, I:L, A:N).

3.1 AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:N
4.0 AV:N/AC:H/AT:P/PR:N/UI:P/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N

Primary rating from Vendor (ce714d77-add3-4f53-aff5-83d477b104bb).

CVSS VectorNVD

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
Low
Integrity
Low
Availability
None

Lifecycle Timeline

3
CVSS changed
Sep 04, 2026 - 13:22 NVD
4.2 (MEDIUM) 5.4 (MEDIUM)
Patch available
Aug 15, 2026 - 15:04 EUVD
Analysis Generated
Aug 15, 2026 - 14:31 vuln.today

DescriptionNVD

@fastify/oauth2 is an OAuth 2.0 plugin for Fastify. In versions from 7.2.0 up to but not including 8.3.0, the plugin validates the OAuth state, and with PKCE the code verifier, by comparing the callback query parameter against an unprefixed, predictable cookie, with no server-side binding to the browser that began the flow. Any party able to write a cookie for the application's host, such as a sibling subdomain under the same registrable domain, can plant matching state and verifier cookies and complete an attacker-owned OAuth flow inside a victim's browser, silently signing the victim in to the attacker's account (login CSRF). It does not expose the victim's own account, credentials, or tokens. The issue is fixed in @fastify/oauth2 8.3.0, which adds an opt-in hostPrefixedCookies option. Users should upgrade to 8.3.0 and enable it, or bind state to a server-side session.

AnalysisAI

Login CSRF in @fastify/oauth2 versions 7.2.0 through 8.2.x allows an attacker controlling a sibling subdomain to plant predictable OAuth state and PKCE code verifier cookies, silently signing a victim into the attacker's account instead of their own. The root cause is the absence of server-side session binding and cookie prefixing - the plugin validates OAuth state exclusively by comparing callback parameters against unprefixed cookies, which sibling subdomains sharing the same registrable domain can freely overwrite. No active exploitation has been confirmed (not in CISA KEV) and no public proof-of-concept exists; the high attack complexity limits opportunistic risk.

Technical ContextAI

The affected package @fastify/oauth2 implements the OAuth 2.0 authorization code flow as a plugin for the Fastify Node.js web framework. The vulnerability class is CWE-352 (Cross-Site Request Forgery), applied specifically to the OAuth callback validation step. The plugin stores the anti-CSRF state parameter and PKCE code_verifier in HTTP cookies without applying cookie prefixes (__Host- or __Secure-). Browser cookie scoping rules allow any subdomain under the same registrable domain (e.g., evil.example.com) to set cookies readable by the target application (app.example.com). Since the plugin performs no server-side session binding - it simply compares the callback query parameter to whatever cookie is present - an attacker who controls a sibling subdomain can pre-plant matching state and verifier values, neutering both the standard OAuth state CSRF protection and the PKCE extension that was specifically designed to prevent code injection. The affected CPE corresponds to the @fastify/oauth2 npm package in the 7.2.x-8.2.x version range on Node.js.

RemediationAI

Upgrade @fastify/oauth2 to version 8.3.0, which introduces the hostPrefixedCookies option; this option must be explicitly enabled in plugin configuration to apply __Host- cookie prefixing, which browsers enforce to prevent sibling subdomains from overwriting cookies. If an immediate upgrade is not feasible, the alternative fix described in the advisory is to bind OAuth state to a server-side session (e.g., express-session or a custom session store) rather than relying solely on cookie comparison - this eliminates the cookie-injection vector entirely but requires additional session infrastructure. As a compensating control where neither option is immediately available, ensure no untrusted parties control any subdomain under the same registrable domain as the application, reducing the attack surface to zero; however, this is a deployment-level constraint rather than a code-level fix and may be difficult to guarantee over time. Advisory reference: https://github.com/fastify/fastify-oauth2/security/advisories/GHSA-p8h8-rj28-m8q9.

CVE-2023-31999 HIGH POC
8.8 Jul 04

All versions of @fastify/oauth2 used a statically generated state parameter at startup time and were used across all req

CVE-2021-22964 HIGH POC
8.8 Oct 14

A redirect vulnerability in the `fastify-static` module version >= 4.2.4 and < 4.4.1 allows remote attackers to redirect

CVE-2025-32442 HIGH POC
7.5 Apr 18

Fastify is a fast and low overhead web framework, for Node.js. Rated high severity (CVSS 7.5), this vulnerability is rem

CVE-2020-8136 HIGH POC
7.5 Mar 20

Prototype pollution vulnerability in fastify-multipart < 1.0.5 allows an attacker to crash fastify applications parsing

CVE-2018-3711 HIGH POC
7.5 Jun 07

Fastify node module before 0.38.0 is vulnerable to a denial-of-service attack by sending a request with "Content-Type: a

CVE-2020-8192 MEDIUM POC
6.5 Jul 30

A denial of service vulnerability exists in Fastify v2.14.1 and v3.0.0-rc.4 that allows a malicious user to trigger reso

CVE-2021-22963 MEDIUM POC
6.1 Oct 14

A redirect vulnerability in the fastify-static module version < 4.2.4 allows remote attackers to redirect users to arbit

CVE-2026-6556 CRITICAL
9.1 Jun 30

Authorization bypass in the @fastify/express middleware-compatibility plugin (versions 4.0.6 and earlier) lets unauthent

CVE-2026-33808 CRITICAL
9.1 Apr 15

Authentication bypass in @fastify/express v4.0.4 and earlier allows remote unauthenticated attackers to access protected

CVE-2026-33807 CRITICAL
9.1 Apr 15

Middleware bypass in Fastify Express plugin (fastify/express) allows complete circumvention of authentication, authoriza

CVE-2022-41919 HIGH
8.8 Nov 22

Fastify is a web framework with minimal overhead and plugin architecture. Rated high severity (CVSS 8.8), this vulnerabi

CVE-2026-2880 HIGH
8.2 Feb 27

Authentication and authorization bypass in @fastify/middie (Node.js middleware library for Fastify) allows remote unauth

Share

CVE-2026-18165 vulnerability details – vuln.today

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy