CVE-2025-32441:
Rack session gets restored after deletion
4.2
Basic Information
Technical Details
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
rack | rubygems | <= 2.2.13 | 2.2.14 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability describes a race condition where a deleted Rack session can be restored by simultaneous requests when using Rack::Session::Pool
. The commit c48e52f7c57e99e1e1bf54c8760d4f082cd1c89d
addresses this issue by modifying two functions in lib/rack/session/pool.rb
: write_session
and delete_session
.
The core of the vulnerability lies in the ability to restore a session after it has been deleted. This restoration happens when session data is written back to the store. The write_session
function is responsible for this action. The patch introduces a crucial check (return false unless get_session_with_fallback(session_id)
) in write_session
before it attempts to store the session data. The absence of this check in the vulnerable version allowed a concurrent request (that had loaded session data before its deletion) to write this data back, effectively 'restoring' the deleted session. The commit message directly confirms that the change to write_session
is to prevent it from succeeding if the session doesn't exist, fixing the concurrent deletion issue.
The delete_session
function was also modified to ensure that when a new session ID is generated after a deletion (if options[:drop]
is false), an empty session is immediately stored for this new ID. This is a hardening measure to prevent the old, deleted session data from being associated with a potentially reused SID. However, the actual act of 'restoring' the session, which is the crux of the vulnerability, occurs within write_session
due to the missing check.
Therefore, Rack::Session::Pool#write_session
is identified as the vulnerable function because its previous implementation allowed the restoration of a deleted session under race conditions.