The vulnerability is an open redirect within the Devise authentication library, specifically in the Timeoutable module that handles session timeouts. The root cause, identified from the patch commit 025fe2124f9928766fc46520e999633b598d0360, lies in the Devise::FailureApp.redirect_url function. For non-GET requests that time out, this function used the raw, unsanitized request.referrer value to determine the redirect destination. The HTTP Referer header is attacker-controllable. An attacker could create a malicious page that submits a form (e.g., a POST request) to the target application. If the victim's session has expired, the application would redirect them to the URL specified in the Referer header, which could be a phishing site.
The patch addresses this by wrapping request.referrer with the extract_path_from_location method. This sanitizes the input by stripping any scheme and host, ensuring that the redirect target is always a local path within the application, thereby mitigating the open redirect risk. The Devise::FailureApp.redirect function is also identified as a key runtime indicator, as it is the function that invokes redirect_url and executes the unsafe redirect.