{"id":"CVE-2026-40295","summary":"Devise: Open Redirect via Unvalidated `request.referrer` in Timeoutable Session Timeout Handler","details":"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.","aliases":["GHSA-jp94-3292-c3xv"],"modified":"2026-06-18T03:56:28.605671362Z","published":"2026-05-22T19:10:57.039Z","related":["CGA-6j2p-2mv7-694p"],"database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/40xxx/CVE-2026-40295.json","cwe_ids":["CWE-601"],"cna_assigner":"GitHub_M"},"references":[{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/40xxx/CVE-2026-40295.json"},{"type":"ADVISORY","url":"https://github.com/heartcombo/devise/security/advisories/GHSA-jp94-3292-c3xv"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-40295"},{"type":"FIX","url":"https://github.com/heartcombo/devise/commit/025fe2124f9928766fc46520e999633b598d0360"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://github.com/heartcombo/devise","events":[{"introduced":"0"},{"fixed":"9ea459de9aec5f1217ad738c58e0d23fb9f5beaa"},{"fixed":"025fe2124f9928766fc46520e999633b598d0360"}],"database_specific":{"cpe":"cpe:2.3:a:heartcombo:devise:*:*:*:*:*:ruby:*:*","source":["CPE_RANGE","REFERENCES"],"extracted_events":[{"introduced":"0"},{"fixed":"5.0.4"}]}}],"versions":["v5.0.3","v5.0.2","v5.0.1","v5.0.0","v5.0.0.rc","v4.9.2","v4.9.1","v4.9.0","v4.8.1","v4.8.0","v4.7.2","v4.7.1","v4.7.0","v4.6.2","v4.6.1","v4.6.0","v4.5.0","v4.4.3","v4.4.2","v4.4.1","v4.4.0","v4.3.0","v4.2.1","v4.2.0","v4.1.0","v4.0.1","v4.0.0","v4.0.0.rc2","v4.0.0.rc1","v3.5.3","v3.5.2","v3.5.1","v3.5.0","v3.4.1","v3.4.0","v3.3.0","v3.2.4","v3.2.3","v3.2.2","v3.2.1","v3.2.0","v3.1.0","v3.1.0.rc2","v3.1.0.rc","v3.0.1","v2.2.4","v3.0.0","v3.0.0.rc","v2.2.3","v2.1.2","v2.2.2","v2.2.1","v2.2.0","v2.2.0.rc","v2.1.1","v2.1.0","v2.1.0.rc2","v2.1.0.rc","v2.0.3","v2.0.2","v2.0.1","v2.0.0","v2.0.0.rc2","v2.0.0.rc","v1.5.1","v1.5.0","v1.5.0.rc1","v1.5.0.rc","v1.4.7","v1.4.6","v1.4.4","v1.4.3","v1.4.2","v1.4.1","v1.4.0","v1.3.1","v1.3.0","v1.2.0","v1.2.rc2","v1.2.rc","v1.1.0","v1.1.rc2","v1.1.rc1","v1.1.rc0","v1.1.pre4","v1.1.pre3","v1.1.pre2","v1.1.pre","v1.0.1","v1.0.0","v0.9.1","v0.9.0","v0.8.2","v0.8.1","v0.8.0","v0.7.5"],"database_specific":{"source":"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2026-40295.json"}}],"schema_version":"1.7.5","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"}]}