{"id":"CVE-2026-40295","published":"2026-05-22T19:10:57Z","modified":"2026-05-26T13:10:00Z","title":"Devise: Open Redirect via Unvalidated `request.referrer` in Timeoutable Session Timeout Handler","vendor":"heartcombo","product":"devise","tier":"tail","description":{"text":"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.","provenance":"source","from":"CVE.org"},"cvss":{"score":6.1,"severity":"MEDIUM","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00241,"percentile":0.15525,"provenance":"source"},"cwes":[{"id":"CWE-601","name":"URL Redirection to Untrusted Site"}],"references":[{"url":"https://github.com/heartcombo/devise/security/advisories/GHSA-jp94-3292-c3xv","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/heartcombo/devise/commit/025fe2124f9928766fc46520e999633b598d0360","tags":["x_refsource_MISC"]}],"priority":{"score":7.4,"factors":[{"name":"EPSS percentile","points":3.1},{"name":"CVSS severity","points":4.27}]},"vendorSlug":"heartcombo","affectedVersions":[{"vendor":"heartcombo","product":"devise","versions":["< 5.0.4"]}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"partial","timestamp":"2026-05-26T13:09:47.384783Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"RubyGems","package":"devise","vulnerableRanges":["<5.0.4"],"patched":["5.0.4"],"from":["GHSA-jp94-3292-c3xv"],"provenance":"source"}],"summary":{"text":"The Timeoutable module in Devise (heartcombo/devise) contains an open redirect in its FailureApp#redirect_url method, which returns the attacker-controllable HTTP Referer header without validation when a non-GET request results in a session timeout. An attacker who can get a victim with an expired session to submit a cross-origin auto-submitting form, which requires user interaction in the form of loading the attacker's page, can redirect that victim to an arbitrary external URL.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T22:14:25Z"},"euvd":{"id":"EUVD-2026-31488","exploited":false,"provenance":"source"},"lineage":{"packageHistory":[{"cve":"CVE-2019-5421","published":"2019-04-03","fixed":"4.6.0","kev":false},{"cve":"CVE-2019-16109","published":"2019-09-08","fixed":"4.7.1","kev":false},{"cve":"CVE-2026-32700","published":"2026-03-18","fixed":"5.0.3","kev":false,"link":{"from":"CVE-2026-32700","to":"CVE-2026-40295","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"RubyGems:devise","fromFixed":"5.0.3","toFixed":"5.0.4","daysApart":65}]}},{"cve":"CVE-2026-40295","published":"2026-05-22","fixed":"5.0.4","kev":false}],"package":"RubyGems:devise"}}