{"id":"GHSA-2ccf-ffrj-m4qw","revision":"eee6b578fd124b6486487397aabc092e","records":[{"revision":"eee6b578fd124b6486487397aabc092e","observedAt":"2026-10-24T13:17:17.793+00:00","statement":{"source":"osv","id":"GHSA-2ccf-ffrj-m4qw","aliases":["CVE-2023-29020"],"title":"CSRF token fixation in fastify-passport","description":"The [CSRF](https://owasp.org/www-community/attacks/csrf) protection enforced by the `@fastify/csrf-protection` library, when combined with `@fastify/passport`, can be bypassed by network and same-site attackers.\n\n## Details\n`fastify/csrf-protection` implements the [synchronizer token pattern](https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#synchronizer-token-pattern) (using plugins `@fastify/session` and `@fastify/secure-session`) by storing a random value used for CSRF token generation in the `_csrf` attribute of a user's session.\n\nThe `@fastify/passport` library does not clear the session object upon authentication, preserving the `_csrf` attribute between pre-login and authenticated sessions. Consequently, CSRF tokens generated before authentication are still valid. Network and [same-site attackers](https://canitakeyoursubdomain.name/) can thus obtain a CSRF token for their pre-session, fixate that pre-session in the victim's browser via cookie tossing, and then perform a CSRF attack after the victim authenticates.\n\n## Fix\nAs a solution, newer versions of `@fastify/passport` include the configuration options\n\n* `clearSessionOnLogin (default: true)` and\n* `clearSessionIgnoreFields (default: ['session'])`\n\nto clear all the session attributes by default, preserving those explicitly defined in `clearSessionIgnoreFields`.\n\n## Credits\n* Pedro Adão (@pedromigueladao), [Instituto Superior Técnico, University of Lisbon](https://tecnico.ulisboa.pt/)\n* Marco Squarcina (@lavish), [Security & Privacy Research Unit, TU Wien](https://secpriv.wien/)","state":0,"publishedAt":"2023-04-21T22:32:47+00:00","modifiedAt":"2026-09-10T03:49:53.1897596+00:00","affected":[{"ecosystem":"npm","name":"@fastify/passport","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"0"},{"kind":"fixed","version":"1.1.0"}]}],"versions":[],"rawVersionEvidence":null},{"ecosystem":"npm","name":"@fastify/passport","ranges":[{"type":"SEMVER","events":[{"kind":"introduced","version":"2.0.0"},{"kind":"fixed","version":"2.3.0"}]}],"versions":[],"rawVersionEvidence":null}],"metrics":[{"system":"CVSS_V3","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N","score":null,"severity":null},{"system":"Publisher rating","vector":null,"score":null,"severity":"MODERATE"}],"references":["https://github.com/fastify/fastify-passport/security/advisories/GHSA-2ccf-ffrj-m4qw","https://nvd.nist.gov/vuln/detail/CVE-2023-29020","https://github.com/fastify/fastify-passport/commit/07c90feab9cba0dd4779e47cfb0717a7e2f01d3d","https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#synchronizer-token-pattern","https://github.com/fastify/fastify-passport","https://owasp.org/www-community/attacks/csrf"],"sourceUrl":"https://github.com/advisories/GHSA-2ccf-ffrj-m4qw","license":"GitHub Advisory Database · CC-BY-4.0","key":"osv:GHSA-2ccf-ffrj-m4qw","identifiers":["GHSA-2ccf-ffrj-m4qw","CVE-2023-29020"]},"retained":false,"historicalAffected":[]}],"coverage":[]}