|
| 1 | +--- |
| 2 | +gem: rack |
| 3 | +cve: 2025-32441 |
| 4 | +ghsa: vpfw-47h7-xj4g |
| 5 | +url: https://github.com/rack/rack-session/security/advisories/GHSA-9j94-67jr-4cqj |
| 6 | +title: Rack session gets restored after deletion |
| 7 | +date: 2025-05-08 |
| 8 | +description: | |
| 9 | + ### Summary |
| 10 | +
|
| 11 | + When using the `Rack::Session::Pool` middleware, simultaneous rack |
| 12 | + requests can restore a deleted rack session, which allows the |
| 13 | + unauthenticated user to occupy that session. |
| 14 | +
|
| 15 | + ### Details |
| 16 | +
|
| 17 | + [Rack session middleware](https://github.com/rack/rack/blob/v2.2.13/lib/rack/session/abstract/id.rb#L263-L270) |
| 18 | + prepares the session at the beginning of request, then saves is back |
| 19 | + to the store with possible changes applied by host rack application. |
| 20 | + This way the session becomes to be a subject of race conditions in |
| 21 | + general sense over concurrent rack requests. |
| 22 | +
|
| 23 | + ### Impact |
| 24 | +
|
| 25 | + When using the `Rack::Session::Pool` middleware, and provided the |
| 26 | + attacker can acquire a session cookie (already a major issue), the |
| 27 | + session may be restored if the attacker can trigger a long running |
| 28 | + request (within that same session) adjacent to the user logging out, |
| 29 | + in order to retain illicit access even after a user has attempted to logout. |
| 30 | +
|
| 31 | + ## Mitigation |
| 32 | +
|
| 33 | + - Update to the latest version of `rack`, or |
| 34 | + - Ensure your application invalidates sessions atomically by marking |
| 35 | + them as logged out e.g., using a `logged_out` flag, instead of |
| 36 | + deleting them, and check this flag on every request to prevent reuse, or |
| 37 | + - Implement a custom session store that tracks session invalidation |
| 38 | + timestamps and refuses to accept session data if the session was |
| 39 | + invalidated after the request began. |
| 40 | +
|
| 41 | + ### Related |
| 42 | +
|
| 43 | + As this code was moved to `rack-session` in Rack 3+, see |
| 44 | + <https://github.com/rack/rack-session/security/advisories/GHSA-9j94-67jr-4cqj> |
| 45 | + for the equivalent advisory in `rack-session` (affecting Rack 3+ only). |
| 46 | +cvss_v3: 4.2 |
| 47 | +patched_versions: |
| 48 | + - ">= 2.2.14" |
| 49 | +related: |
| 50 | + ghsa: |
| 51 | + - https://github.com/rack/rack-session/security/advisories/GHSA-9j94-67jr-4cqj |
| 52 | + url: |
| 53 | + - https://nvd.nist.gov/vuln/detail/CVE-2025-32441 |
| 54 | + - https://github.com/rack/rack/security/advisories/GHSA-vpfw-47h7-xj4g |
| 55 | + - https://github.com/rack/rack/commit/c48e52f7c57e99e1e1bf54c8760d4f082cd1c89d |
| 56 | + - https://github.com/rack/rack/blob/v2.2.13/lib/rack/session/abstract/id.rb#L263-L270 |
| 57 | + - https://github.com/advisories/GHSA-vpfw-47h7-xj4g |
0 commit comments