cve.bz

CVE-2024-31999 fastify fastify-secure-session: Insufficient Session Expiration

7.4 highEPSS 0.6%Fix available

High (7.4) in fastify fastify-secure-session. EPSS 0.6% estimated probability of exploitation activity in the next 30 days. Fixed in @fastify/secure-session 7.3.0.

On this page
@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.

Severity

CVSS 3.1

7.4 high
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N
EPSS
0.6% (unchanged from 0.6% a week ago; 0.6% 30 days ago) estimated probability of exploitation activity in the next 30 days; 51st percentile. Scored 2026-11-22. A forecast for this CVE across the internet, not for your own systems.
CISA's assessment (SSVC)
Exploitation: none · Automatable: no · Technical impact: partial, assessed 2024-07-31. From CISA's Vulnrichment in the CVE List: whether it is exploited, whether exploiting it can be automated, and how much control it gives.
CWE
CWE-613 Insufficient Session Expiration deprecated by MITRE see CWE-1463, CWE-1464
OWASP Top 10
A07:2025 Authentication Failures
Published
Modified
NVD analysis
Deferred: the NVD does not plan to analyze it
Record from
the NVD, synced

Fix and patched versions

  • @fastify/secure-session (npm): fixed in 7.3.0

Ask an AI about this CVE

Show the promptExplain CVE-2024-31999 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2024-31999?via=ask-ai-copy and https://cve.bz/cve/CVE-2024-31999?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2024-31999 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the CNA's record in the CVE List.

ProductAffected
fastify-secure-session< 7.3.0

Packages (OSV)

AdvisoryEcosystemPackageAffectedFixed in
GHSA-9wwp-q7wq-jx35npm@fastify/secure-session<7.3.07.3.0

References

Check your stackJSON