Skip to content
FlawDB
Sign in
Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

CVE-2026-40295

MEDIUM 6.1EPSS 17%

Devise: Open Redirect via Unvalidated `request.referrer` in Timeoutable Session Timeout Handler

Also known as GHSA-jp94-3292-c3xv

Mitigation

  • Upgrade devise to 5.0.4 or later.

Who should check

  • Projects that depend on RubyGems package devise (< 5.0.4)
  • Anyone running heartcombo devise < 5.0.4

Vulnerability facts

Affected
devise < 5.0.4
Fixed in
5.0.4
Exploited in the wild
Not in CISA KEV
Public exploit / PoC
None known
Remote exploitation
Remote, no login needed
CVSS
6.1 (v3.1, CNA)CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:NOpen in CVSS calculator
Show all 8 CVSS metrics
  • Attack vector: Network
  • Attack complexity: Low
  • Privileges required: None
  • User interaction: Required
  • Scope: Changed (impact reaches other components)
  • Confidentiality impact: Low
  • Integrity impact: Low
  • Availability impact: None
EPSS
0.32% chance of exploitation in 30 days (percentile 17, 2026-11-26)
CWE
CWE-601
Published
Modified

Description

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.

Affected and fixed versions

Package / productAffectedFixedSource
RubyGems devise< 5.0.45.0.4osv
heartcombo devise< 5.0.4—cvelist

Check your systems with an agent

Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.

Check whether anything I run is affected by CVE-2026-40295. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-40295.md
Affected: devise < 5.0.4
Fixed in: 5.0.4

Steps:
1. Search this machine and project for devise (RubyGems), heartcombo devise: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.

References

FAQ

Is CVE-2026-40295 being exploited?

There is no confirmed exploitation: CVE-2026-40295 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.32% chance of exploitation in the next 30 days (as of 2026-11-26).

How serious is CVE-2026-40295?

Medium: CVSS 6.1 (v3.1, scored by CNA). Remote, no login needed. A user has to take an action, such as opening a link, for the attack to work.

Which versions are affected by CVE-2026-40295?

devise < 5.0.4.

Is there a fix for CVE-2026-40295?

Yes. Fixed in 5.0.4. Upgrade devise to 5.0.4 or later.

How do I check if I'm affected by CVE-2026-40295?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

Sponsors