Devise Open Redirect Vulnerability in Timeoutable Session Handling

Vulnerability

A vulnerability exists in Devise, an authentication solution for Rails, in versions 5.0.3 and prior. When the Timeoutable module is active, the FailureApp#redirect_url method improperly handles the HTTP Referer header for non-GET requests that time out, allowing for unvalidated redirects to external URLs. This issue arises because the non-GET timeout path lacks the same protections as the GET path, which uses a server-side value that cannot be manipulated by the client. As a result, an attacker can exploit this vulnerability to redirect users with expired sessions from a trusted domain to an external site, potentially leading to phishing or malware delivery.

Impact

Exploitation of this vulnerability allows for open redirection to attacker-controlled URLs, bypassing browser security warnings. This could be used to conduct phishing attacks or distribute malware.

Reproduction

To reproduce this vulnerability, enable the Timeoutable module in Devise and use a version prior to 5.0.4. Then, send a non-GET request from a page that you control, including an auto-submitting cross-origin form. Ensure that the request referrer header points to an external URL. This will trigger the timeout handling in Devise's FailureApp, which will redirect the user to the specified external URL without proper validation.

Remediation

Users are advised to upgrade to Devise version 5.0.4, where this vulnerability has been patched. If an immediate upgrade is not possible, the patch can be applied as a monkey-patch in a Rails initializer by modifying the Devise::FailureApp#redirect_url and Devise::Controllers::StoreLocation#extract_path_from_location methods. Remember to remove the monkey-patch after upgrading.

Added: May 26, 2026, 2:48 PM
Updated: May 26, 2026, 2:48 PM

Vulnerability Rating

Custom Algorithm
spread
0.0
impact
0.2
exploitability
7.0
remediation
0.0
relevance
9.1
threat
4.8
urgency
2.9
incentive
0.0

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.