{"id":"CVE-2023-31999","aliases":["EUVD-2023-2056","GHSA-g8x5-p9qc-cf95"],"status":"published","title":"@fastify/oauth2 vulnerable to Cross Site Request Forgery due to reused Oauth2 state","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.\r\n\r\nv7.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.","severity":{"version":"3.1","score":8.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","level":"high","assessor":"primary","from":"nvd"},"epss":{"day":"2026-11-12","score":0.00705,"percentile":0.53821,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-352"],"published":"2023-07-04T16:29:20Z","modified":"2026-10-28T02:30:32Z","fixes":[{"ecosystem":"npm","package":"@fastify/oauth2","fixed_in":["7.2.0"],"sources":["ghsa","osv"]}],"affected":[{"source":"ghsa","ecosystem":"npm","package":"@fastify/oauth2","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"7.2.0"}]}]},{"source":"osv","ecosystem":"npm","package":"@fastify/oauth2","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"7.2.0"}]}]}],"products":[{"vendor":"fastify","product":"oauth2"},{"vendor":"npm","product":"@fastify/oauth2"}],"references":[{"url":"https://hackerone.com/reports/2020418","tags":["x_transferred","Permissions Required","web"]},{"url":"https://auth0.com/docs/secure/attack-protection/state-parameters","tags":["x_transferred","Exploit","web"]},{"url":"https://github.com/fastify/fastify-oauth2/releases/tag/v7.2.0","tags":["x_transferred","Release Notes","web"]},{"url":"https://github.com/fastify/fastify-oauth2/security/advisories/GHSA-g8x5-p9qc-cf95","tags":["web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2023-35935","tags":["advisory"]},{"url":"https://github.com/fastify/fastify-oauth2/commit/bff756b456cbb769080631af2beb85671ff4c79c","tags":["web"]},{"url":"https://github.com/advisories/GHSA-g8x5-p9qc-cf95"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/31xxx/CVE-2023-31999.json","tags":["advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2023-31999","tags":["advisory"]},{"url":"https://github.com/fastify/fastify-oauth2","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2023-31999","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.\r\n\r\nv7.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.","status":"published","published":"2023-07-04T16:29:20.281Z","modified":"2024-11-26T18:47:25.202Z","updated_at":"2026-11-02T14:35:27.810438Z"}],"euvd":[{"id":"EUVD-2023-2056","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.\r\n\r\nv7.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.","status":"published","published":"2023-07-04T16:29:20Z","modified":"2024-11-26T18:47:25Z","cvss":[{"version":"","score":0,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","level":"none"}],"updated_at":"2026-11-03T00:04:46.610778Z"}],"ghsa":[{"id":"GHSA-g8x5-p9qc-cf95","title":"@fastify/oauth2 vulnerable to Cross Site Request Forgery due to reused Oauth2 state","description":"### Impact\n\nAll versions of @fastify/oauth2 used a statically generated `state` parameter at startup time and were used across all requests for all users.\nThe 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.\n\n### Patches\n\nv7.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.\n\nNote that this contains a breaking change in the `checkStateFunction` function, which now accepts the full `Request` object.\n\n### Workarounds\n\nThere are no known workarounds.\n\n### References\n\n* [Prevent Attacks and Redirect Users with OAuth 2.0 State Parameters](https://auth0.com/docs/secure/attack-protection/state-parameters)\n","status":"published","published":"2023-07-05T21:36:56Z","modified":"2023-11-10T05:01:55Z","cvss":[{"version":"3.1","score":7.4,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N","level":"high"}],"cwes":["CWE-352"],"updated_at":"2026-11-02T14:37:18.40412Z"}],"nvd":[{"id":"CVE-2023-31999","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.\r\n\r\nv7.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.","status":"published","published":"2023-07-04T17:15:10.657Z","modified":"2026-06-17T05:57:48.99Z","cvss":[{"version":"3.1","score":8.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","level":"high","assessor":"primary"}],"cwes":["CWE-352"],"updated_at":"2026-11-02T14:08:14.715708Z"}],"osv":[{"id":"GHSA-g8x5-p9qc-cf95","title":"@fastify/oauth2 vulnerable to Cross Site Request Forgery due to reused Oauth2 state","description":"### Impact\n\nAll versions of @fastify/oauth2 used a statically generated `state` parameter at startup time and were used across all requests for all users.\nThe 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.\n\n### Patches\n\nv7.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.\n\nNote that this contains a breaking change in the `checkStateFunction` function, which now accepts the full `Request` object.\n\n### Workarounds\n\nThere are no known workarounds.\n\n### References\n\n* [Prevent Attacks and Redirect Users with OAuth 2.0 State Parameters](https://auth0.com/docs/secure/attack-protection/state-parameters)\n","status":"published","published":"2023-07-05T21:36:56Z","modified":"2023-11-08T04:12:32.265455Z","cvss":[{"version":"3.1","score":7.4,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N","level":"high"}],"cwes":["CWE-352"],"updated_at":"2026-11-02T15:46:47.472172Z"},{"id":"CVE-2023-31999","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.\r\n\r\nv7.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.","status":"published","published":"2023-07-04T16:29:20.281Z","modified":"2026-10-28T02:30:32.112899037Z","updated_at":"2026-11-02T15:44:31.790231Z"}]}}
