Devise: Open Redirect via Unvalidated `request.referrer` in Timeoutable Session Timeout Handler
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- Required
- Attack complexity
- Low
- Impact type
- Spoofing
- Confidentiality · integrity · availability
- Low · Low · None
- Fix status
- Fixed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA and GitHub. Impact type from CWE-601.
Summary
Devise is an authentication solution for Rails based on Warden. In versions 5.0.3 and below, when the Timeoutable module is enabled in Devise, the FailureApp#redirect_url method returns request.referrer — the HTTP Referer header, which is attacker-controllable — without validation for any non-GET request that results in a session timeout. An attacker who hosts a page with an auto-submitting cross-origin form can cause a victim with an expired Devise session to be redirected to an arbitrary external URL. This contrasts with the GET timeout path (which uses server-side attempted_path) and Devise's own store_location_for mechanism (which strips external hosts via extract_path_from_location), both of which are protected; only the non-GET timeout redirect path is unprotected. Expired-session users can be silently redirected from the trusted app domain to attacker-controlled URLs, enabling phishing and malware delivery while bypassing browser warnings. Note: Rails' built-in open-redirect protection does not mitigate this issue. Devise::FailureApp is an ActionController::Metal app with its own isolated copy of the relevant redirect configuration, so config.action_controller.action_on_open_redirect = :raise (and the older raise_on_open_redirects setting) do not reach it. This issue has been fixed in version 5.0.4.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- No
- Technical impact
- Partial
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| heartcombo | devise | before 5.0.4 | 5.0.4 | Patch available | CNA |
| — | devise (RubyGems) | before 5.0.4 | 5.0.4 | Patch available | GHSA-jp94-3292-c3xv |
- devise Vendorheartcombo Affected before 5.0.4 Fixed in 5.0.4 Patch available CNA
- devise (RubyGems) Vendor— Affected before 5.0.4 Fixed in 5.0.4 Patch available GHSA-jp94-3292-c3xv
CPE configurations NVD · 1
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:heartcombo:devise:*:*:*:*:*:ruby:*:* | before 5.0.4 | Vulnerable | heartcombo |
- cpe:2.3:a:heartcombo:devise:*:*:*:*:*:ruby:*:* Versions before 5.0.4 Vulnerable ·heartcombo
Remediation
- Fix · CNA devise (heartcombo) Fixed in 5.0.4
- Fix · GHSA-jp94-3292-c3xv devise (RubyGems) Fixed in 5.0.4 Advisory →
Timeline
- 2026-10-02 Threatist record created from CVE-2026-40295
- 2026-10-03 Alias added: GHSA-jp94-3292-c3xv
References
Advisory 2
More heartcombo Devise vulnerabilities
- TI-2026-25192 Devise has a confirmable "change email" race condition that permits user to confirm email they have no access to CVSS 4.0MEDIUM 6.0
- TI-2015-06843 The Devise gem before 3.5.4 for Ruby mishandles Remember Me cookies for sessions, which… CVSS 3.1HIGH 7.5
Sources
- CVE-2026-40295 · CVE Program
- CVE-2026-40295 · NVD
- FIRST EPSS
- GHSA-jp94-3292-c3xv · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences