Miggo Logo

CVE-2025-46336: Rack session gets restored after deletion

4.2

CVSS Score
3.1

Basic Information

EPSS Score
0.06409%
Published
5/8/2025
Updated
5/9/2025
KEV Status
No
Technology
TechnologyRuby

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
rack-sessionrubygems>= 2.0.0, < 2.1.12.1.1

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability described is a race condition in Rack::Session::Pool where a deleted session can be restored by a concurrent request. The provided patch (commit c28c4a8c1861d814e09f2ae48264ac4c40be2d3b) modifies two key methods: write_session and delete_session in lib/rack/session/pool.rb.

The core of the vulnerability lies in the write_session method. Before the patch, this method did not check if the session it was about to write still existed or was valid. If a session was deleted by one request, a concurrent, long-running request (which had loaded the session data before deletion) could subsequently call write_session and successfully write its stale data, thus restoring the deleted session. The patch fixes this by adding a crucial check: return false unless get_session_with_fallback(session_id). This line ensures that the session is still considered valid before any data is written to it.

Therefore, Rack::Session::Pool#write_session is identified as the vulnerable function because it contained the flaw (the missing check) that allowed the session restoration to occur. While the delete_session method was also modified to improve the robustness of session handling (by ensuring a new, empty session is stored when a session is renewed after deletion, rather than just generating a SID), the actual act of incorrectly restoring the session was performed by the write_session method in its vulnerable state.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

## Summ*ry W**n usin* t** `R**k::S*ssion::Pool` mi**l*w*r*, simult*n*ous r**k r*qu*sts **n r*stor* * **l*t** r**k s*ssion, w*i** *llows t** un*ut**nti**t** us*r to o**upy t**t s*ssion. ## **t*ils [R**k s*ssion mi**l*w*r*](*ttps://*it*u*.*om/r**k/r

Reasoning

T** vuln*r**ility **s*ri*** is * r*** *on*ition in `R**k::S*ssion::Pool` w**r* * **l*t** s*ssion **n ** r*stor** *y * *on*urr*nt r*qu*st. T** provi*** p*t** (*ommit ****************************************) mo*i*i*s two k*y m*t*o*s: `writ*_s*ssion` *