CVE-2026-18165
@fastify/oauth2 vulnerable to Login CSRF via plantable OAuth state cookies
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.
INFO
Published Date :
Aug. 15, 2026, 2:17 p.m.
Last Modified :
Aug. 15, 2026, 2:17 p.m.
Remotely Exploit :
No
Source :
ce714d77-add3-4f53-aff5-83d477b104bb
Affected Products
The following products are affected by CVE-2026-18165
vulnerability.
Even if cvefeed.io is aware of the exact versions of the
products
that
are
affected, the information is not represented in the table below.
No affected product recoded yet
CVSS Scores
| Score | Version | Severity | Vector | Exploitability Score | Impact Score | Source |
|---|---|---|---|---|---|---|
| CVSS 3.1 | MEDIUM | ce714d77-add3-4f53-aff5-83d477b104bb |
Solution
- Upgrade to @fastify/oauth2 version 8.3.0 or newer.
- Enable the hostPrefixedCookies option.
- Alternatively, bind state to a server-side session.
References to Advisories, Solutions, and Tools
Here, you will find a curated list of external links that provide in-depth
information, practical solutions, and valuable tools related to
CVE-2026-18165.
| URL | Resource |
|---|---|
| https://cna.openjsf.org/security-advisories.html | |
| https://github.com/fastify/fastify-oauth2/security/advisories/GHSA-p8h8-rj28-m8q9 |
CWE - Common Weakness Enumeration
While CVE identifies
specific instances of vulnerabilities, CWE categorizes the common flaws or
weaknesses that can lead to vulnerabilities. CVE-2026-18165 is
associated with the following CWEs:
Common Attack Pattern Enumeration and Classification (CAPEC)
Common Attack Pattern Enumeration and Classification
(CAPEC)
stores attack patterns, which are descriptions of the common attributes and
approaches employed by adversaries to exploit the CVE-2026-18165
weaknesses.
We scan GitHub repositories to detect new proof-of-concept exploits. Following list is a collection of public exploits and proof-of-concepts, which have been published on GitHub (sorted by the most recently updated).
Results are limited to the first 15 repositories due to potential performance issues.
The following list is the news that have been mention
CVE-2026-18165 vulnerability anywhere in the article.
The following table lists the changes that have been made to the
CVE-2026-18165 vulnerability over time.
Vulnerability history details can be useful for understanding the evolution of a vulnerability, and for identifying the most recent changes that may impact the vulnerability's severity, exploitability, or other characteristics.
-
New CVE Received by ce714d77-add3-4f53-aff5-83d477b104bb
Aug. 15, 2026
Action Type Old Value New Value Added Affected [{'vendor': '@fastify/oauth2', 'product': '@fastify/oauth2', 'versions': [{'status': 'affected', 'version': '7.2.0', 'lessThan': '8.3.0', 'versionType': 'semver'}, {'status': 'unaffected', 'version': '8.3.0', 'versionType': 'semver'}], 'packageURL': 'pkg:npm/@fastify/oauth2', 'defaultStatus': 'unaffected'}] Added 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. Added CVSS V3.1 AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:N Added CWE CWE-352 Added Reference https://cna.openjsf.org/security-advisories.html Added Reference https://github.com/fastify/fastify-oauth2/security/advisories/GHSA-p8h8-rj28-m8q9