{"id":"EUVD-2023-1154","enisaUuid":"80909e7b-f355-38f4-aa14-f05ce6ce9e79","description":"@fastify/passport is a port of passport authentication library for the Fastify ecosystem. The CSRF (Cross-Site Request Forger) protection enforced by the `@fastify/csrf-protection` library, when combined with `@fastify/passport` in affected versions, can be bypassed by network and same-site attackers. `fastify/csrf-protection` implements the 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\u0027s session. The `@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 can thus obtain a CSRF token for their pre-session, fixate that pre-session in the victim\u0027s browser via cookie tossing, and then perform a CSRF attack after the victim authenticates. As a solution, newer versions of `@fastify/passport` include the configuration options: `clearSessionOnLogin (default: true)` and `clearSessionIgnoreFields (default: [\u0027passport\u0027, \u0027session\u0027])` to clear all the session attributes by default, preserving those explicitly defined in `clearSessionIgnoreFields`.","datePublished":"Apr 21, 2023, 10:31:56 PM","dateUpdated":"Feb 4, 2025, 7:38:09 PM","baseScore":6.5,"baseScoreVersion":"3.1","baseScoreVector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N","references":"https://github.com/fastify/fastify-passport/security/advisories/GHSA-2ccf-ffrj-m4qw\nhttps://github.com/fastify/fastify-passport/commit/07c90feab9cba0dd4779e47cfb0717a7e2f01d3d\nhttps://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#synchronizer-token-pattern\nhttps://owasp.org/www-community/attacks/csrf\n","aliases":"CVE-2023-29020\nGHSA-2ccf-ffrj-m4qw\n","assigner":"GitHub_M","epss":0.38,"enisaIdProduct":[{"id":"1971de6a-217e-3de2-8ace-5e9c4e338900","product":{"name":"fastify-passport","vendor":{"name":"fastify"}},"product_version":"\u003c 1.1.0"},{"id":"406aab6b-85b6-3ba2-9ee0-ce910c44aa16","product":{"name":"fastify-passport","vendor":{"name":"fastify"}},"product_version":"2.0.0, \u003c 2.3.0"}],"enisaIdVendor":[{"id":"e71fd954-c61e-3be4-9251-e083c0f57ea5","vendor":{"name":"fastify"}}],"enisaIdVulnerability":[{"id":"80b85edc-cc39-3b91-998a-4182fdca7612","vulnerability":{"id":"CVE-2023-29020","description":"@fastify/passport is a port of passport authentication library for the Fastify ecosystem. The CSRF (Cross-Site Request Forger) protection enforced by the `@fastify/csrf-protection` library, when combined with `@fastify/passport` in affected versions, can be bypassed by network and same-site attackers. `fastify/csrf-protection` implements the 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\u0027s session. The `@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 can thus obtain a CSRF token for their pre-session, fixate that pre-session in the victim\u0027s browser via cookie tossing, and then perform a CSRF attack after the victim authenticates. As a solution, newer versions of `@fastify/passport` include the configuration options: `clearSessionOnLogin (default: true)` and `clearSessionIgnoreFields (default: [\u0027passport\u0027, \u0027session\u0027])` to clear all the session attributes by default, preserving those explicitly defined in `clearSessionIgnoreFields`.","datePublished":"Apr 21, 2023, 10:31:56 PM","dateUpdated":"Feb 4, 2025, 7:38:09 PM","status":"PUBLISHED","baseScore":6.5,"baseScoreVersion":"3.1","baseScoreVector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N","references":"https://github.com/fastify/fastify-passport/security/advisories/GHSA-2ccf-ffrj-m4qw\nhttps://github.com/fastify/fastify-passport/commit/07c90feab9cba0dd4779e47cfb0717a7e2f01d3d\nhttps://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#synchronizer-token-pattern\nhttps://owasp.org/www-community/attacks/csrf\n","enisa_id":"EUVD-2023-1154\n","assigner":"GitHub_M","epss":0.38,"dataProcessed":"Nov 18, 2026, 7:24:36 AM","vulnerabilityProduct":[{"id":"c518df53-2165-397a-91ea-889e2b8523ce","product":{"name":"fastify-passport","vendor":{"name":"fastify"}},"product_version":"2.0.0, \u003c 2.3.0"},{"id":"d3c51845-323d-3724-961e-d5eec86e8906","product":{"name":"fastify-passport","vendor":{"name":"fastify"}},"product_version":"\u003c 1.1.0"}],"vulnerabilityVendor":[{"id":"eee4ee2c-c4a2-3684-b35b-df8421ae54c0","vendor":{"name":"fastify"}}]}},{"id":"96a3d507-4e34-396c-812c-3049558a0c65","vulnerability":{"id":"GHSA-2ccf-ffrj-m4qw","description":"CSRF token fixation in fastify-passport","datePublished":"Apr 21, 2023, 10:32:47 PM","dateUpdated":"Apr 24, 2023, 3:56:27 PM","baseScore":null,"references":"https://github.com/fastify/fastify-passport/security/advisories/GHSA-2ccf-ffrj-m4qw\nhttps://nvd.nist.gov/vuln/detail/CVE-2023-29020\nhttps://github.com/fastify/fastify-passport/commit/07c90feab9cba0dd4779e47cfb0717a7e2f01d3d\nhttps://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#synchronizer-token-pattern\nhttps://github.com/fastify/fastify-passport\nhttps://owasp.org/www-community/attacks/csrf\n","enisa_id":"EUVD-2023-1154\n","aliases":"GHSA-2ccf-ffrj-m4qw\nCVE-2023-29020\n","epss":0.0,"dataProcessed":"Nov 15, 2026, 2:32:34 AM","vulnerabilityProduct":[],"vulnerabilityVendor":[]}}],"enisaIdAdvisory":[]}