CVE-2026-40295: CWE-601: URL Redirection to Untrusted Site ('Open Redirect') in heartcombo devise
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.
AI Analysis
Technical Summary
Devise versions prior to 5.0.4, when using the Timeoutable module, improperly handle redirection after session timeout for non-GET requests by returning the HTTP Referer header directly without validation. This header can be controlled by attackers, enabling open redirect attacks that redirect users to untrusted external sites. The vulnerability bypasses Rails' built-in open redirect protections because Devise::FailureApp operates with isolated redirect configuration. This flaw can be exploited to redirect users silently from the trusted app domain to attacker-controlled URLs, increasing risks of phishing and malware delivery. The issue is resolved in Devise version 5.0.4.
Potential Impact
An attacker can cause users with expired sessions to be redirected to arbitrary external URLs by exploiting the unvalidated use of the HTTP Referer header in non-GET request timeout redirects. This can facilitate phishing attacks or malware distribution by leveraging trusted domain redirects. The vulnerability does not impact the GET request timeout path or other Devise redirect mechanisms that properly validate redirect destinations. There is no indication of known exploits in the wild at this time.
Mitigation Recommendations
Upgrade Devise to version 5.0.4 or later, where this open redirect vulnerability has been fixed. Until upgrading, be aware that the Timeoutable module's non-GET timeout redirect path is vulnerable to open redirect attacks. No other official or temporary fixes are documented. Patch status is not explicitly confirmed in the advisory, but the fix is included in version 5.0.4.
CVE-2026-40295: CWE-601: URL Redirection to Untrusted Site ('Open Redirect') in heartcombo devise
Description
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.
CVSS v3.1
Score 6.1medium
Affected software
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
Devise versions prior to 5.0.4, when using the Timeoutable module, improperly handle redirection after session timeout for non-GET requests by returning the HTTP Referer header directly without validation. This header can be controlled by attackers, enabling open redirect attacks that redirect users to untrusted external sites. The vulnerability bypasses Rails' built-in open redirect protections because Devise::FailureApp operates with isolated redirect configuration. This flaw can be exploited to redirect users silently from the trusted app domain to attacker-controlled URLs, increasing risks of phishing and malware delivery. The issue is resolved in Devise version 5.0.4.
Potential Impact
An attacker can cause users with expired sessions to be redirected to arbitrary external URLs by exploiting the unvalidated use of the HTTP Referer header in non-GET request timeout redirects. This can facilitate phishing attacks or malware distribution by leveraging trusted domain redirects. The vulnerability does not impact the GET request timeout path or other Devise redirect mechanisms that properly validate redirect destinations. There is no indication of known exploits in the wild at this time.
Mitigation Recommendations
Upgrade Devise to version 5.0.4 or later, where this open redirect vulnerability has been fixed. Until upgrading, be aware that the Timeoutable module's non-GET timeout redirect path is vulnerable to open redirect attacks. No other official or temporary fixes are documented. Patch status is not explicitly confirmed in the advisory, but the fix is included in version 5.0.4.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-04-10T20:22:44.035Z
- Cvss Version
- 3.1
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 6a10b5b4e1370fbb4848af54
Added to database: 05/22/2026, 19:59:48 UTC
Last enriched: 05/29/2026, 20:41:47 UTC
Last updated: 07/31/2026, 19:22:58 UTC
Views: 61
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.