GHSA-gmj8-hvj3-49mw: Action Pack: Missing SameSite attribute on session cookies from Action Pack session stores
Impact Action Pack session stores other than ActionDispatch::Session::CookieStore (CacheStore, MemCacheStore, and third-party stores built on AbstractStore, AbstractSecureStore or the session mixins) write the session cookie without a SameSite attribute, regardless of config.actiondispatch.cookiessamesiteprotection, which defaults to :lax. Only CookieStore applies the configured policy. In browsers that do not treat a cookie without the attribute as SameSite=Lax, a cross-site request could carry the session cookie, possibly leading to cross-site request forgery against actions that do not verify an authenticity token, such as those of API-only applications.
Applications are affected when they use a session store other than CookieStore and do not pass samesite: to config.sessionstore.
Details In the fixed releases, every session store sets the session cookie's SameSite attribute from cookiessamesiteprotection when its options have no :samesite key. An explicit samesite: option, including samesite: nil, and a :samesite value in a store's DEFAULTOPTIONS still take precedence.
Workarounds Pass samesite: when configuring the session store, for example config.sessionstore :cachestore, samesite: :lax.
Releases The fixed releases are available at the normal locations.
Patches for those who cannot upgrade at once: - 8.1: https://github.com/rails/rails/commit/2d9f502df941e31ce9bad0e846564f49396bed46.patch - 8.0: https://github.com/rails/rails/commit/f2392996be723708271a8d30bfcf0edc221e53ef.patch
Credit This issue was responsibly reported by HackerOne researcher tjvc.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
rubygems/actionpackto a version that resolves this vulnerability.Fixed in 8.0.5.2 - Upgrade
Upgrade
rubygems/actionpackto a version that resolves this vulnerability.Fixed in 8.1.4.1 - Configuration
Pass same_site: :lax when configuring non-CookieStore session stores, for example config.session_store :cache_store, same_site: :lax.
Action Pack session store same_site = :lax