cve.bz

CVE-2026-18165 fastify fastify\/oauth2: Cross Site Reference Forgery

5.4 mediumEPSS 0.1%

Medium (5.4) in fastify fastify\/oauth2. EPSS 0.1% estimated probability of exploitation activity in the next 30 days.

On this page
@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.

Severity

CVSS 3.1

5.4 medium
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N
EPSS
0.1% (unchanged from 0.1% a week ago; 0.1% 30 days ago) estimated probability of exploitation activity in the next 30 days; 3rd percentile. Scored 2026-11-22. A forecast for this CVE across the internet, not for your own systems.
CISA's assessment (SSVC)
Exploitation: none · Automatable: no · Technical impact: partial, assessed 2026-08-17. From CISA's Vulnrichment in the CVE List: whether it is exploited, whether exploiting it can be automated, and how much control it gives.
CWE
CWE-352 Cross-Site Request Forgery (Cross Site Reference Forgery)
OWASP Top 10
A01:2025 Broken Access Control
Published
Modified
NVD analysis
Analyzed
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2026-18165 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2026-18165?via=ask-ai-copy and https://cve.bz/cve/CVE-2026-18165?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2026-18165 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

  • fastify:fastify\/oauth2

Versions

From the CNA's record in the CVE List.

ProductAffected
@fastify/oauth2from 7.2.0 before 8.3.0

Red Hat

Red Hat rates this Low.

Red Hat's statement

A login CSRF vulnerability was found in @fastify/oauth2, an OAuth 2.0 plugin for the Fastify web framework. In versions 7.2.0 through 8.2.0, the plugin validates the OAuth state parameter and PKCE 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. An attacker able to write a cookie for the application's host, such as through control of a sibling subdomain under the same registrable domain or via cross-site scripting on a sibling subdomain, can plant matching state and verifier cookies and complete an attacker-owned OAuth flow inside a victim's browser. This allows the attacker to silently sign the victim into the attacker's account (login CSRF), enabling the attacker to harvest any data or activity the victim performs while unknowingly using the attacker's account. This issue affects Red Hat OpenShift Dev Spaces versions 3.27 through 3.30, which bundle the vulnerable @fastify/oauth2 version 8.2.0.

Red Hat's mitigation

This issue is fixed in @fastify/oauth2 version 8.3.0. Red Hat will provide updated versions of OpenShift Dev Spaces that include the fixed library version.

Until updates are available, administrators can reduce the risk of login CSRF attacks by implementing the following mitigations:

1. Isolate OpenShift Dev Spaces instances on dedicated domains or subdomains that do not share registrable domains with untrusted applications or user-controlled content.

2. If server-side session management is available, bind OAuth state parameters to server-side sessions rather than relying solely on cookie-based state validation.

3. Monitor for suspicious OAuth flows, particularly cases where users appear to be signed into unexpected accounts or workspaces they did not create.

4. Educate developers about the risks of using OAuth login links from untrusted sources, and encourage verification of account identity after OAuth login completes.

5. When upgrading to @fastify/oauth2 8.3.0 or later, enable the hostPrefixedCookies option to prevent cross-subdomain cookie planting attacks.

Note that this vulnerability requires the attacker to control a sibling subdomain or exploit a cross-site scripting vulnerability on a sibling subdomain, which significantly raises the attack complexity in most deployment scenarios.

ProductPackageStateAdvisory
Red Hat OpenShift Dev Spacesdevspaces/dashboard-rhel9Fix deferred

Contains Red Hat Security Data © Red Hat, Inc., licensed under CC BY 4.0. Source: https://access.redhat.com/security/data. Modified: reformatted. Red Hat's page for CVE-2026-18165.

Attack patterns (CAPEC)

  • CAPEC-62 Cross Site Request Forgery Likelihood: High · Severity: Very High
  • CAPEC-111 JSON Hijacking (aka JavaScript Hijacking) Likelihood: High · Severity: High
  • CAPEC-462 Cross-Domain Search Timing Severity: Medium
  • CAPEC-467 Cross Site Identification Severity: Low

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits.

References

Check your stackJSON