CVE-2026-18165
Received Received - Intake

OAuth State Validation Bypass in Fastify OAuth2 Plugin

Vulnerability report for CVE-2026-18165, including description, CVSS score, EPSS score, affected products, exploitability, helpful resources, and attack-flow context.

Publication date: 2026-08-15

Last updated on: 2026-08-15

Assigner: openjs

Description

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

CVSS Scores

EPSS Scores

Probability:
Percentile:

Meta Information

Published
2026-08-15
Last Modified
2026-08-15
Generated
2026-08-16
AI Q&A
2026-08-15
EPSS Evaluated
N/A
NVD
EUVD

Affected Vendors & Products

Showing 2 associated CPEs
Vendor Product Version / Range
fastify oauth2 to 8.3.0 (exc)
fastify oauth2 8.3.0

Helpful Resources

Exploitability

CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-352 The web application does not, or cannot, sufficiently verify whether a request was intentionally provided by the user who sent the request, which could have originated from an unauthorized actor.

Attack-Flow Graph

AI Quick Actions

Instant insights powered by AI
Executive Summary

This vulnerability affects the @fastify/oauth2 plugin for Fastify. It allows an attacker to perform a login CSRF attack by planting predictable cookies on a victim's browser. The attacker can then complete an OAuth flow using their own account, silently signing the victim in without exposing their credentials or tokens.

Impact Analysis

If you use the vulnerable versions of @fastify/oauth2, an attacker could trick you into logging into their account without your knowledge. This could lead to unauthorized access to your application's data or actions performed under the attacker's identity.

Mitigation Strategies

Upgrade @fastify/oauth2 to version 8.3.0 or later. Enable the hostPrefixedCookies option to bind state to a server-side session and prevent cookie-based attacks.

Chat Assistant

Ask questions about this CVE
Hi! I’m here to help you understand CVE-2026-18165. Ask me anything about the vulnerability, its impact, or mitigation strategies.
0/70

EPSS Chart