CVE-2026-18165: @fastify/oauth2 vulnerable to Login CSRF via plantable OAuth state cookies

Published Aug 15, 2026
·
Updated

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

Affected Software

1 affected component
npm/@fastify/oauth2>=7.2.0<8.3.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade @fastify/oauth2 to a version that resolves this vulnerability.

    Fixed in 8.3.0
  2. Configuration

    After upgrading to @fastify/oauth2 8.3.0, enable the opt-in hostPrefixedCookies option to prevent login CSRF via plantable OAuth state/verifier cookies.

    @fastify/oauth2 hostPrefixedCookies = true

Event History

Aug 15, 2026
CVE Published
via MITRE·01:45 PM
Data Sourced
via MITRE·01:45 PM
DescriptionSeverityWeakness
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-18165?

CVE-2026-18165 has a medium severity score of 4.2.

2

How do I fix CVE-2026-18165?

To fix CVE-2026-18165, upgrade the @fastify/oauth2 package to version 8.3.0 or later.

3

What type of vulnerability is CVE-2026-18165?

CVE-2026-18165 is classified as a Cross-Site Request Forgery (CSRF) vulnerability.

4

Which versions of @fastify/oauth2 are affected by CVE-2026-18165?

CVE-2026-18165 affects @fastify/oauth2 versions from 7.2.0 up to but not including 8.3.0.

5

What impact does CVE-2026-18165 have on applications?

CVE-2026-18165 can lead to unauthorized actions being performed on behalf of users due to vulnerable state cookies.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203