# CVE-2024-31999: @fastify/secure-session: Reuse of destroyed secure session cookie

- Priority: **Routine**
- Reason: Not severe (CVSS 7.4, network access); no exploitation reported by the 5 checked sources
- Next step: Fix in the normal cadence
- Status: published
- Published: 2024-04-10 · Modified: 2024-08-02
- Aliases: GHSA-9wwp-q7wq-jx35
- Record: https://cvemate.com/vulnerability/CVE-2024-31999 · JSON: https://cvemate.com/vulnerability/CVE-2024-31999/json

## 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.
```

## Signals

- CVSS: 7.4 high (v3.1, CVE.org) CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:N
- EPSS: 0.617%, percentile 51.001%, as of 2026-12-04
- Known exploited (KEV): CISA not listed, ENISA not listed, CIRCL not listed
- Ransomware use: none recorded
- Public exploits: 0

## Affected

- fastify fastify-secure-session: \< 7.3.0
- @fastify secure-session (Npm): \< 7.3.0

## References

- <https://github.com/fastify/fastify-secure-session/security/advisories/GHSA-9wwp-q7wq-jx35>
- <https://github.com/fastify/fastify-secure-session/commit/56d66642ecc633cff0606927601e81cdac361370>
- <https://nvd.nist.gov/vuln/detail/CVE-2024-31999>
- <https://github.com/fastify/fastify-secure-session>

---

Data as of 2026-12-05T09:43:48.603Z. The priority label is CveMate's own model from public evidence, not an official rating, and it knows nothing about your assets. How labels are decided: https://cvemate.com/faq#priority
