Cross site request forgery token fixation in fastify-passport
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- Required
- Attack complexity
- Low
- Impact type
- Tampering, Spoofing
- Confidentiality · integrity · availability
- None · High · None
- Fix status
- Fixed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA and GitHub. Impact type from CWE-352 and CWE-384.
Summary
@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`.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- No
- Technical impact
- Partial
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| fastify | fastify-passport | before 1.1.0; 2.0.0 to before 2.3.0 | 1.1.0, 2.3.0 | Patch available | CNA |
| — | @fastify/passport (npm) | before 1.1.0 | 1.1.0 | Patch available | GHSA-2ccf-ffrj-m4qw |
| — | @fastify/passport (npm) | 2.0.0 to before 2.3.0 | 2.3.0 | Patch available | GHSA-2ccf-ffrj-m4qw |
- fastify-passport Vendorfastify Affected before 1.1.0; 2.0.0 to before 2.3.0 Fixed in 1.1.0, 2.3.0 Patch available CNA
- @fastify/passport (npm) Vendor— Affected before 1.1.0 Fixed in 1.1.0 Patch available GHSA-2ccf-ffrj-m4qw
- @fastify/passport (npm) Vendor— Affected 2.0.0 to before 2.3.0 Fixed in 2.3.0 Patch available GHSA-2ccf-ffrj-m4qw
Remediation
- Fix · CNA fastify-passport (fastify) Fixed in 1.1.0, 2.3.0
- Fix · GHSA-2ccf-ffrj-m4qw @fastify/passport (npm) Fixed in 1.1.0 Advisory →
- Fix · GHSA-2ccf-ffrj-m4qw @fastify/passport (npm) Fixed in 2.3.0 Advisory →
Timeline
- 2026-10-02 Threatist record created from CVE-2023-29020
- 2026-10-03 Alias added: GHSA-2ccf-ffrj-m4qw
References
Advisory 2
More fastify Passport vulnerabilities
- TI-2023-13480 Session fixation in fastify-passport CVSS 3.1HIGH 8.1
Sources
- CVE-2023-29020 · CVE Program
- CVE-2023-29020 · NVD
- FIRST EPSS
- GHSA-2ccf-ffrj-m4qw · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences