Skip to main content
Vulnerability Database/CVE-2024-26144

CVE-2024-26144: Rails Active Storage Session Leak Vulnerability

CVE-2024-26144 is an information disclosure flaw in Rails Active Storage that may leak sensitive session data through cached Set-Cookie headers. This post explains its impact, affected versions, and mitigation steps.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2024-26144 Overview

CVE-2024-26144 is an information disclosure vulnerability in Ruby on Rails Active Storage. The flaw affects Rails versions starting with 5.2.0 and allows session cookies to leak through intermediate proxy caches. Active Storage sends a Set-Cookie header along with the user's session cookie when serving blobs. It simultaneously sets Cache-Control: public on the response. Certain proxies may cache the Set-Cookie header, causing one user's session cookie to be returned to other users. The Rails team addressed the issue in versions 7.0.8.1 and 6.1.7.7.

Critical Impact

Shared proxy caches can serve one user's session cookie to unrelated clients, enabling session hijacking against authenticated Rails applications that proxy Active Storage blobs. [CWE-200]

Affected Products

  • Ruby on Rails versions 5.2.0 through versions prior to 6.1.7.7
  • Ruby on Rails 7.0.x versions prior to 7.0.8.1
  • Applications using Active Storage ProxyController for blobs and representations

Discovery Timeline

  • 2024-02-27 - CVE-2024-26144 published to the National Vulnerability Database (NVD)
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2024-26144

Vulnerability Analysis

Active Storage exposes two controllers that proxy blob content through the Rails application: ActiveStorage::Blobs::ProxyController and ActiveStorage::Representations::ProxyController. Both controllers wrap responses in http_cache_forever public: true, which marks the response as cacheable by any shared proxy. The Rails middleware stack also attaches a session cookie via Set-Cookie on every response by default.

The combination produces an HTTP response that instructs intermediaries to cache content containing an authenticated user's session identifier. A downstream shared cache, such as a CDN or reverse proxy, can store the cached response and later serve the stored Set-Cookie header to a different client requesting the same blob URL.

The recipient then operates under the original user's session, which breaks authentication boundaries for any Rails application serving blobs through the proxy controllers.

Root Cause

The root cause is a conflict between the default session middleware behavior and the cache directives chosen by Active Storage. The proxy controllers set Cache-Control: public for performance but did not strip or disable the session cookie before emitting the response. CWE-200 (Exposure of Sensitive Information to an Unauthorized Actor) captures this class of flaw.

Attack Vector

Exploitation requires that the vulnerable Rails application sit behind a shared cache that honors Cache-Control: public on responses carrying Set-Cookie. An attacker requests a public blob URL and, if the proxy caches the response, subsequent users receive the attacker-authored request's cached headers. In the inverse scenario, an attacker requests a cached blob and inherits the victim's session cookie that was stored by the proxy.

The upstream patch adds the ActiveStorage::DisableSession concern to both proxy controllers, preventing the session cookie from being attached to blob responses:

ruby
 class ActiveStorage::Blobs::ProxyController < ActiveStorage::BaseController
   include ActiveStorage::SetBlob
   include ActiveStorage::Streaming
+  include ActiveStorage::DisableSession
 
   def show
     if request.headers["Range"].present?

Source: Rails Commit 723f545

ruby
 class ActiveStorage::Representations::ProxyController < ActiveStorage::Representations::BaseController
   include ActiveStorage::Streaming
+  include ActiveStorage::DisableSession
 
   def show
     http_cache_forever public: true do

Source: Rails Commit 78fe149

Detection Methods for CVE-2024-26144

Indicators of Compromise

  • HTTP responses from Active Storage proxy routes (/rails/active_storage/blobs/proxy/... and /rails/active_storage/representations/proxy/...) that contain both Set-Cookie and Cache-Control: public headers
  • Shared cache hits on blob URLs where the stored object includes a Set-Cookie header
  • Unexpected session changes correlated with requests to Active Storage blob URLs in application logs

Detection Strategies

  • Audit outbound HTTP responses from Rails blob proxy endpoints and flag any response that emits a session cookie alongside a public cache directive
  • Review CDN or reverse proxy cache storage for cached entries whose response headers include Set-Cookie, particularly on Active Storage paths
  • Enumerate running Rails and Active Storage gem versions across the fleet and compare against the fixed releases 7.0.8.1 and 6.1.7.7

Monitoring Recommendations

  • Add alerting in the reverse proxy layer for any cacheable response that carries a Set-Cookie header
  • Capture and retain web access logs for Active Storage proxy routes to support forensic analysis of session reuse
  • Track dependency manifests (Gemfile.lock) in CI to detect use of vulnerable Rails versions before deployment

How to Mitigate CVE-2024-26144

Immediate Actions Required

  • Upgrade Rails to 7.0.8.1 or 6.1.7.7 or later, which include the ActiveStorage::DisableSession concern on the proxy controllers
  • Invalidate or purge CDN and reverse proxy caches that may hold responses from Active Storage proxy routes
  • Rotate session secrets (secret_key_base) if there is evidence that session cookies were cached by a shared proxy

Patch Information

The fix is delivered in Rails 7.0.8.1 and 6.1.7.7. The upstream patches are tracked in commits 723f545 and 78fe149, with full advisory details in GHSA-8h22-8cf7-hq6g and the Rails discussion thread.

Workarounds

  • Configure the upstream proxy or CDN to strip Set-Cookie headers from responses on Active Storage blob and representation routes
  • Serve Active Storage blobs via the redirect controller rather than the proxy controller where feasible, since the redirect flow does not stream content through Rails
  • Disable public caching for proxy responses by overriding the controllers to omit the public: true directive until the upgrade is applied
bash
# Upgrade Rails to a fixed version
bundle update rails --conservative

# Verify the installed version is patched
bundle exec rails --version
# Expected: Rails 7.0.8.1 or Rails 6.1.7.7 (or later)

# Purge CDN cache for Active Storage proxy routes (example for a generic CDN API)
curl -X POST "https://cdn.example.com/purge" \
  -d 'path=/rails/active_storage/blobs/proxy/*' \
  -d 'path=/rails/active_storage/representations/proxy/*'

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.