CVE-2026-40295Devise: Open Redirect via Unvalidated `request.referrer` in Timeoutable Session Timeout…
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.
What to do
Fixed builds are available from RubyGems: see the table below for the fixed version per release.
Debian, Ubuntu have not shipped a fix for every release yet.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 24.04 | ruby-devise | Under investigation | UBUNTU-CVE-2026-40295 | |
| Ubuntu 22.04 | ruby-devise | Under investigation | UBUNTU-CVE-2026-40295 | |
| Ubuntu 20.04 | ruby-devise | Fix pending | UBUNTU-CVE-2026-40295 | |
| Ubuntu 18.04 | ruby-devise | Fix pending | UBUNTU-CVE-2026-40295 | |
| Ubuntu 16.04 | ruby-devise | Fix pending | UBUNTU-CVE-2026-40295 | |
| Debian 12 | ruby-devise | Fix pending | DEBIAN-CVE-2026-40295 | |
| RubyGems library | devise | Fixed | 5.0.4 | GHSA-jp94-3292-c3xv |
What the vendor says
As published in the CVE record by GitHub_M, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- heartcombo devise: affected: < 5.0.4
References
- https://github.com/heartcombo/devise/security/advisories/GHSA-jp94-3292-c3xv
- https://github.com/heartcombo/devise/commit/025fe2124f9928766fc46520e999633b598d0360
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.