CVE-2026-40295

Source
https://cve.org/CVERecord?id=CVE-2026-40295
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2026-40295.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2026-40295
Aliases
Downstream
Related
Published
2026-05-22T19:10:57.039Z
Modified
2026-06-18T03:56:28.605671362Z
Severity
  • 6.1 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N CVSS Calculator
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#redirecturl 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 attemptedpath) and Devise's own storelocationfor mechanism (which strips external hosts via extractpathfromlocation), 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.actioncontroller.actiononopenredirect = :raise (and the older raiseonopenredirects setting) do not reach it. This issue has been fixed in version 5.0.4.

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

Affected packages

Git / github.com/heartcombo/devise

Affected ranges

Type
GIT
Repo
https://github.com/heartcombo/devise
Events
Introduced
0 Unknown introduced commit / All previous commits are affected
Fixed
Fixed
Database specific
{
    "cpe": "cpe:2.3:a:heartcombo:devise:*:*:*:*:*:ruby:*:*",
    "source": [
        "CPE_RANGE",
        "REFERENCES"
    ],
    "extracted_events": [
        {
            "introduced": "0"
        },
        {
            "fixed": "5.0.4"
        }
    ]
}

Affected versions

v0.*
v0.7.5
v0.8.0
v0.8.1
v0.8.2
v0.9.0
v0.9.1
v1.*
v1.0.0
v1.0.1
v1.1.0
v1.1.pre
v1.1.pre2
v1.1.pre3
v1.1.pre4
v1.1.rc0
v1.1.rc1
v1.1.rc2
v1.2.0
v1.2.rc
v1.2.rc2
v1.3.0
v1.3.1
v1.4.0
v1.4.1
v1.4.2
v1.4.3
v1.4.4
v1.4.6
v1.4.7
v1.5.0
v1.5.0.rc
v1.5.0.rc1
v1.5.1
v2.*
v2.0.0
v2.0.0.rc
v2.0.0.rc2
v2.0.1
v2.0.2
v2.0.3
v2.1.0
v2.1.0.rc
v2.1.0.rc2
v2.1.1
v2.1.2
v2.2.0
v2.2.0.rc
v2.2.1
v2.2.2
v2.2.3
v2.2.4
v3.*
v3.0.0
v3.0.0.rc
v3.0.1
v3.1.0
v3.1.0.rc
v3.1.0.rc2
v3.2.0
v3.2.1
v3.2.2
v3.2.3
v3.2.4
v3.3.0
v3.4.0
v3.4.1
v3.5.0
v3.5.1
v3.5.2
v3.5.3
v4.*
v4.0.0
v4.0.0.rc1
v4.0.0.rc2
v4.0.1
v4.1.0
v4.2.0
v4.2.1
v4.3.0
v4.4.0
v4.4.1
v4.4.2
v4.4.3
v4.5.0
v4.6.0
v4.6.1
v4.6.2
v4.7.0
v4.7.1
v4.7.2
v4.8.0
v4.8.1
v4.9.0
v4.9.1
v4.9.2
v5.*
v5.0.0
v5.0.0.rc
v5.0.1
v5.0.2
v5.0.3

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2026-40295.json"