{"schemaVersion":1,"url":"https://cve.openhack.com/cve/CVE-2023-29020","id":"CVE-2023-29020","title":"Cross site request forgery token fixation in fastify-passport","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/sess","descriptionLong":"@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's 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's 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: ['passport', 'session'])` to clear all the session attributes by default, preserving those explicitly defined in `clearSessionIgnoreFields`.","published":"2023-04-21T22:31:56.768Z","updated":"2026-10-28T02:31:13.947895161Z","reserved":"2023-03-29T17:39:16.144Z","status":"Modified","rejected":false,"assigner":"GitHub_M","metric":{"version":"3.1","score":6.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N","rating":"medium","source":"GitHub_M"},"metrics":[{"version":"3.1","score":6.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N","rating":"medium","source":"GitHub_M"},{"version":"3.1","score":6.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N","rating":"medium","source":"github.com"},{"version":"3.1","score":6.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N","rating":"medium","source":"NVD"},{"version":"3.1","score":6.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N","rating":"medium","source":"OSV"},{"version":"3.1","score":6.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N","rating":"medium","source":"GitHub"}],"rating":"medium","products":["fastify-passport"],"affectedProducts":[{"vendor":"fastify","product":"fastify-passport","defaultStatus":null,"versions":[{"version":"< 1.1.0","status":"affected"},{"version":">= 2.0.0, < 2.3.0","status":"affected"}],"platforms":[]}],"packages":[{"ecosystem":"npm","name":"@fastify/passport","purl":"pkg:npm/%40fastify/passport","ranges":["<1.1.0",">=2.0.0 <2.3.0"],"fixed":["1.1.0","2.3.0"],"advisory":"GHSA-2ccf-ffrj-m4qw"}],"cwes":["CWE-384","CWE-352"],"aliases":["GHSA-2ccf-ffrj-m4qw"],"references":[{"url":"https://github.com/fastify/fastify-passport/security/advisories/GHSA-2ccf-ffrj-m4qw","tags":["x_refsource_CONFIRM","x_transferred","Vendor Advisory","advisory","web"]},{"url":"https://github.com/fastify/fastify-passport/commit/07c90feab9cba0dd4779e47cfb0717a7e2f01d3d","tags":["x_refsource_MISC","x_transferred","Patch","fix","web"]},{"url":"https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#synchronizer-token-pattern","tags":["x_refsource_MISC","x_transferred","Technical Description","web"]},{"url":"https://owasp.org/www-community/attacks/csrf","tags":["x_refsource_MISC","x_transferred","Technical Description","web"]},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/29xxx/CVE-2023-29020.json","tags":["advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2023-29020","tags":["advisory"]},{"url":"https://github.com/fastify/fastify-passport","tags":["package"]}],"patchReferenced":true,"fixAvailable":true,"exploitReferenced":false,"kev":false,"kevAdded":null,"kevDue":null,"kevEntry":null,"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"partial"},"epss":0.00384,"epssPercentile":0.33181,"sources":[{"name":"CVE List","url":"https://www.cve.org/CVERecord?id=CVE-2023-29020","ok":true},{"name":"NVD","url":"https://nvd.nist.gov/vuln/detail/CVE-2023-29020","ok":true,"note":"Modified"},{"name":"OSV","url":"https://osv.dev/vulnerability/CVE-2023-29020","ok":true,"note":"1 package"},{"name":"GitHub Advisory","url":"https://github.com/advisories/GHSA-2ccf-ffrj-m4qw","ok":true,"note":"GHSA-2ccf-ffrj-m4qw"},{"name":"CISA KEV","url":"https://www.cisa.gov/known-exploited-vulnerabilities-catalog","ok":true,"note":"not listed"},{"name":"EPSS","url":"https://api.first.org/data/v1/epss?cve=CVE-2023-29020","ok":true,"note":"scored 2026-11-19"}],"aiTitle":false,"tech":[],"critical":[],"attention":null}