Ecosyste.ms: Advisories

An open API service providing security vulnerability metadata for many open source software ecosystems.

Security Advisories: GSA_kwCzR0hTQS1nOHg1LXA5cWMtY2Y5Nc4AA0OQ

@fastify/oauth2 vulnerable to Cross Site Request Forgery due to reused Oauth2 state

Impact

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.

Patches

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.

Workarounds

There are no known workarounds.

References

Permalink: https://github.com/advisories/GHSA-g8x5-p9qc-cf95
JSON: https://advisories.ecosyste.ms/api/v1/advisories/GSA_kwCzR0hTQS1nOHg1LXA5cWMtY2Y5Nc4AA0OQ
Source: GitHub Advisory Database
Origin: Unspecified
Severity: High
Classification: General
Published: 10 months ago
Updated: 6 months ago


CVSS Score: 7.4
CVSS vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N

Identifiers: GHSA-g8x5-p9qc-cf95, CVE-2023-31999
References: Repository: https://github.com/fastify/fastify-oauth2
Blast Radius: 9.9

Affected Packages

npm:@fastify/oauth2
Dependent packages: 7
Dependent repositories: 22
Downloads: 31,361 last month
Affected Version Ranges: < 7.2.0
Fixed in: 7.2.0
All affected versions: 5.0.0, 5.1.0, 6.0.0, 6.1.0, 7.0.0, 7.0.1, 7.1.0, 7.1.1
All unaffected versions: 7.2.0, 7.2.1, 7.2.2, 7.3.0, 7.4.0, 7.5.0, 7.6.0, 7.7.0, 7.8.0, 7.8.1