{"id":"CVE-2024-31999","published":"2024-04-10T21:59:54Z","modified":"2024-08-02T01:59:50Z","title":"@fastify/secure-session: Reuse of destroyed secure session cookie","vendor":"fastify","product":"fastify-secure-session","tier":"tail","description":{"text":"@festify/secure-session creates a secure stateless cookie session for Fastify. At the end of the request handling, it will encrypt all data in the session with a secret key and attach the ciphertext as a cookie value with the defined cookie name. After that, the session on the server side is destroyed. When an encrypted cookie with matching session name is provided with subsequent requests, it will decrypt the ciphertext to get the data. The plugin then creates a new session with the data in the ciphertext. Thus theoretically the web instance is still accessing the data from a server-side session, but technically that session is generated solely from a user provided cookie (which is assumed to be non-craftable because it is encrypted with a secret key not known to the user). The issue exists in the session removal process. In the delete function of the code, when the session is deleted, it is marked for deletion. However, if an attacker could gain access to the cookie, they could keep using it forever. Version 7.3.0 contains a patch for the issue. As a workaround, one may include a \"last update\" field in the session, and treat \"old sessions\" as expired.","provenance":"source","from":"CVE.org"},"cvss":{"score":7.4,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00877,"percentile":0.5671,"provenance":"source"},"cwes":[{"id":"CWE-613","name":"DEPRECATED: Insufficient Session Expiration"}],"references":[{"url":"https://github.com/fastify/fastify-secure-session/security/advisories/GHSA-9wwp-q7wq-jx35","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/fastify/fastify-secure-session/commit/56d66642ecc633cff0606927601e81cdac361370","tags":["x_refsource_MISC"]}],"priority":{"score":16.5,"factors":[{"name":"EPSS percentile","points":11.34},{"name":"CVSS severity","points":5.18}]},"vendorSlug":"fastify","affectedVersions":[{"vendor":"fastify","product":"fastify-secure-session","versions":["< 7.3.0"]}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"partial","timestamp":"2024-07-31T17:54:07.860415Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"npm","package":"@fastify/secure-session","vulnerableRanges":["<7.3.0"],"patched":["7.3.0"],"from":["GHSA-9wwp-q7wq-jx35"],"provenance":"source"}],"summary":{"text":"The fastify-secure-session plugin for Fastify, distributed via the @fastify/secure-session package, has a flaw in its session deletion logic: when a session is deleted, it is only marked for deletion, so the encrypted cookie remains usable. An attacker who obtains a copy of that cookie can continue to use it to authenticate and access the session data indefinitely, provided they can reach the application over the network and the victim's cookie is exposed to them, which requires user interaction.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T21:29:53Z"},"euvd":{"id":"EUVD-2024-1178","exploited":false,"provenance":"source"}}