medium · CVSS v3 4.2
CVE-2026-117549
The vulnerability in @fastify/secure-session allows a session cookie with an invalid signature to be decrypted and accepted, enabling a hold
Overview
The vulnerability in @fastify/secure-session allows a session cookie with an invalid signature to be decrypted and accepted, enabling a holder of an old session cookie to continue using it after the signing secret is rotated. This flaw exists in Fastify session plugins 7.5.0 through 8.4.1 and can be exploited without knowledge of the encryption key. It is a medium‑severity issue that can undermine session integrity for affected Fastify applications.
Description
@fastify/secure-session is a session plugin for Fastify that stores an encrypted session in a cookie. In versions 7.5.0 through 8.4.1, when the plugin is configured with the signed cookie option, it calls the cookie unsign routine but, when the signature check reports the value as invalid, still passes the original cookie value to the session decoder, so a session whose signature did not validate is decrypted anyway. The practical effect appears when an application supplies the cookie signing secret independently of the session encryption key and rotates only the signing secret to retire existing sessions while keeping the encryption key active, because a holder of an old session cookie can strip the now obsolete signature and keep using the session. The attacker must already possess an unexpired encrypted session cookie and needs neither secret, and cannot forge session data, extend expiry, or survive rotation of the encryption key. The issue is fixed in @fastify/secure-session 8.4.2, which no longer decodes the session when the signed cookie option is set and the signature check fails, and users should upgrade to 8.4.2 or later. As a workaround, rotate the session encryption key rather than relying on rotation of the cookie signing secret alone.
Impact
Confidentiality: an attacker can maintain access to a valid session, potentially exposing sensitive data. Integrity: the session data remains unaltered but is accepted despite signature failure. Availability: no direct impact. Defenders using Fastify should be aware that session hijacking is possible until mitigated.
Remediation
Upgrade @fastify/secure-session to version 8.4.2 or later, where the plugin no longer decodes sessions when the signed cookie option is set and the signature check fails. As a temporary measure, rotate the session encryption key instead of relying solely on signing secret rotation, and invalidate existing sessions if possible.
Risk context
The CVSS v3 score is 4.2 (medium). No EPSS data is available. The issue is not critical but should be addressed promptly to prevent session hijacking in production environments.
Affected products
- Fastify @fastify/secure-session
- Node.js applications using Fastify
Scores
- Severity
- medium
- CVSS v2
- 3.6
- CVSS v3
- 4.2
- CVSS v4
- —
- EPSS
- —