{"answers":{"affected":"2 open source packages ship an affected version, including devise. It affects 1 product.","exploited":"There is no known exploitation of CVE-2026-40295 in the wild and no public exploit code.","fix":"Upgrade devise to 5.0.4 or later.","what":"CVE-2026-40295 is a medium-severity vulnerability in heartcombo devise, published on 22 May 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link."},"fix_prompt":"Check this codebase for CVE-2026-40295 and fix it if it is affected.\n\nWhat it is: CVE-2026-40295 is a medium-severity vulnerability in heartcombo devise, published on 22 May 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.\nExploitation: There is no known exploitation of CVE-2026-40295 in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- devise (RubyGems): affected all versions; fixed in 5.0.4\n- devise (RubyGems): affected all versions; fixed in 5.0.4\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/CVE-2026-40295/ (Markdown: https://insights.sbomify.com/CVE-2026-40295/index.md)","id":"CVE-2026-40295","markdown":"https://insights.sbomify.com/CVE-2026-40295/index.md","name":"CVE-2026-40295","record":{"aliases":["DEBIAN-CVE-2026-40295","GHSA-jp94-3292-c3xv","UBUNTU-CVE-2026-40295"],"analysis":{"component_type":"library","fix_type":"upgrade","impacts":["security_bypass"],"network_reachable":"yes","non_default_config":true,"product_category":"Ruby authentication library","requires_auth":"none","summary":"Attackers can redirect users with expired sessions to malicious sites via unvalidated referrer headers in Devise's timeout handler, enabling phishing.","user_interaction":"required","vuln_class":"open_redirect"},"analysis_generated_by":"qwen3.8-flash-next","assigner":"GitHub_M","cpe":[{"product":"devise","vendor":"heartcombo"}],"cvss":{"score":6.1,"severity":"medium","source":"cna","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N","version":"3.1"},"cwes":[{"id":"CWE-601","name":"URL Redirection to Untrusted Site"}],"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.","ecosystems":["RubyGems"],"exploits":{"exploitdb":0,"first_seen":null,"github_poc":0,"max_poc_stars":null,"metasploit":0,"nuclei":0,"refs":[],"tier":"none_known"},"has_fix":true,"headline":"Devise: Open Redirect via Unvalidated `request.referrer` in Timeoutable Session Timeout Handler","id":"CVE-2026-40295","indexable":true,"kev":null,"kind":"cve","links":{"ecosystem":"RubyGems","product":null,"products":[],"type":"open_redirect","year":"2026"},"n_packages":2,"n_references":2,"next":{"headline":"PhpSpreadsheet vulnerable to XSS in HTML writer via custom number format codes","id":"CVE-2026-40296"},"packages":[{"ecosystem":"RubyGems","fixed":["5.0.4"],"introduced":["0"],"last_affected":[],"package":"devise","purl":null,"source":"GHSA-jp94-3292-c3xv"},{"ecosystem":"RubyGems","fixed":["5.0.4"],"introduced":["0"],"last_affected":[],"package":"devise","purl":"pkg:gem/devise","source":"GHSA-jp94-3292-c3xv"}],"prev":{"headline":"OpenFGA Playground Preshared Key Exposure","id":"CVE-2026-40293"},"products":["devise"],"published":"2026-05-22","related":[{"cvss_score":7.5,"headline":"Devise Gem for Ruby Unauthorized Access Using \"Remember Me\" Cookie","id":"CVE-2015-8314","kev_date_added":null,"published":"2023-12-12"},{"cvss_score":6,"headline":"Devise has a confirmable \"change email\" race condition that permits user to confirm email they have no access to","id":"CVE-2026-32700","kev_date_added":null,"published":"2026-03-18"}],"sources":[{"class":"attribution","licence":"CVE Terms of Use (MITRE)","name":"CVE List","prefix":"CVE"},{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"},{"class":"attribution","licence":"US public information, NVD API terms","name":"NVD"},{"class":"attribution","licence":"CWE Terms of Use","name":"CWE (MITRE)"},{"class":"attribution","licence":"FIRST CVSS licence","name":"CVSS (FIRST)"}],"ssvc":{"automatable":"no","exploitation":"none","technical_impact":"partial"},"state":"PUBLISHED","updated":"2026-05-26","vendors":["heartcombo"]},"summary":"Attackers can redirect users with expired sessions to malicious sites via unvalidated referrer headers in Devise's timeout handler, enabling phishing.","url":"https://insights.sbomify.com/CVE-2026-40295/"}