Ruby/devise/0.8.2


Flexible authentication solution for Rails with Warden

https://rubygems.org/gems/devise
UNKNOWN

12 Security Vulnerabilities

Devise has a confirmable "change email" race condition permits user to confirm email they have no access to

Published date: 2026-03-17T17:24:17Z
CVE: CVE-2026-32700
Links:

Impact

A race condition in Devise's Confirmable module allows an attacker to confirm an email address they do not own. This affects any Devise application using the reconfirmable option (the default when using Confirmable with email changes).

By sending two concurrent email change requests, an attacker can desynchronize the confirmation_token and unconfirmed_email fields. The confirmation token is sent to an email the attacker controls, but the unconfirmed_email in the database points to a victim's email address. When the attacker uses the token, the victim's email is confirmed on the attacker's account.

Patches

This is patched in Devise v5.0.3. Users should upgrade as soon as possible.

Workarounds

Applications can override this specific method from Devise models to force unconfirmed_email to be persisted when unchanged: (assuming your model is User)

class User < ApplicationRecord
  protected

  def postpone_email_change_until_confirmation_and_regenerate_confirmation_token
    unconfirmed_email_will_change!
    super
  end
end

Note: Mongoid does not seem to respect that will_change! should force the attribute to be persisted, even if it did not really change, so you might have to implement a workaround similar to Devise by setting changed_attributes["unconfirmed_email"] = nil as well.

Affected versions: ["5.0.2", "5.0.1", "5.0.0", "5.0.0.rc", "4.9.4", "4.9.3", "4.9.2", "4.9.1", "4.9.0", "4.8.1", "4.8.0", "4.7.3", "4.7.2", "4.7.1", "4.7.0", "4.6.2", "4.6.1", "4.6.0", "4.5.0", "4.4.3", "4.4.2", "4.4.1", "4.4.0", "4.3.0", "4.2.1", "4.2.0", "4.1.1", "4.1.0", "4.0.3", "4.0.2", "4.0.1", "4.0.0", "4.0.0.rc2", "4.0.0.rc1", "3.5.10", "3.5.9", "3.5.8", "3.5.7", "3.5.6", "3.5.5", "3.5.4", "3.5.3", "3.5.2", "3.5.1", "3.4.1", "3.4.0", "3.3.0", "3.2.4", "3.2.3", "3.2.2", "3.2.1", "3.2.0", "3.1.2", "3.1.1", "3.1.0", "3.1.0.rc2", "3.0.4", "3.0.3", "3.0.2", "3.0.1", "3.0.0", "3.0.0.rc", "2.2.8", "2.2.7", "2.2.6", "2.2.5", "2.2.4", "2.2.3", "2.2.2", "2.2.1", "2.2.0", "2.2.0.rc", "2.1.4", "2.1.3", "2.1.2", "2.1.0", "2.1.0.rc2", "2.1.0.rc", "2.0.6", "2.0.5", "2.0.4", "2.0.2", "2.0.1", "2.0.0", "2.0.0.rc2", "2.0.0.rc", "1.5.4", "1.5.3", "1.5.2", "1.5.1", "1.5.0", "1.5.0.rc1", "1.4.9", "1.4.8", "1.4.7", "1.4.5", "1.4.3", "1.4.2", "1.4.1", "1.3.4", "1.3.3", "1.3.2", "1.3.1", "1.3.0", "1.2.1", "1.2.0", "1.2.rc2", "1.2.rc", "1.1.9", "1.1.8", "1.1.7", "1.1.6", "1.1.5", "1.1.4", "1.1.3", "1.1.2", "1.1.1", "1.1.0", "1.1.pre4", "1.1.pre3", "1.1.pre2", "1.1.pre", "1.1.rc2", "1.1.rc1", "1.1.rc0", "1.0.11", "1.0.10", "1.0.9", "1.0.8", "1.0.7", "1.0.6", "1.0.5", "1.0.4", "1.0.3", "1.0.2", "1.0.1", "1.0.0", "0.9.2", "0.9.1", "0.9.0", "0.8.2", "0.8.1", "0.8.0", "0.7.5", "0.7.4", "0.7.3", "0.7.2", "0.7.1", "0.7.0", "0.6.3", "0.6.2", "0.6.1", "0.6.0", "0.5.6", "0.5.5", "0.5.4", "0.5.3", "0.5.2", "0.5.1", "0.5.0", "0.4.3", "0.4.2", "0.4.1", "0.4.0", "0.3.0", "0.2.3", "0.2.2", "0.2.1", "0.2.0", "0.1.1", "0.1.0"]
Secure versions: [5.0.4]
Recommendation: Update to version 5.0.4.

devise Time-of-check Time-of-use Race Condition vulnerability

Published date: 2019-03-19T18:03:25Z
CVE: CVE-2019-5421
Links:

Devise ruby gem before 4.6.0 when the lockable module is used is vulnerable to a time-of-check time-of-use (TOCTOU) race condition due to increment_failed_attempts within the Devise::Models::Lockable class not being concurrency safe.

Affected versions: ["4.5.0", "4.4.3", "4.4.2", "4.4.1", "4.4.0", "4.3.0", "4.2.1", "4.2.0", "4.1.1", "4.1.0", "4.0.3", "4.0.2", "4.0.1", "4.0.0", "4.0.0.rc2", "4.0.0.rc1", "3.5.10", "3.5.9", "3.5.8", "3.5.7", "3.5.6", "3.5.5", "3.5.4", "3.5.3", "3.5.2", "3.5.1", "3.4.1", "3.4.0", "3.3.0", "3.2.4", "3.2.3", "3.2.2", "3.2.1", "3.2.0", "3.1.2", "3.1.1", "3.1.0", "3.1.0.rc2", "3.0.4", "3.0.3", "3.0.2", "3.0.1", "3.0.0", "3.0.0.rc", "2.2.8", "2.2.7", "2.2.6", "2.2.5", "2.2.4", "2.2.3", "2.2.2", "2.2.1", "2.2.0", "2.2.0.rc", "2.1.4", "2.1.3", "2.1.2", "2.1.0", "2.1.0.rc2", "2.1.0.rc", "2.0.6", "2.0.5", "2.0.4", "2.0.2", "2.0.1", "2.0.0", "2.0.0.rc2", "2.0.0.rc", "1.5.4", "1.5.3", "1.5.2", "1.5.1", "1.5.0", "1.5.0.rc1", "1.4.9", "1.4.8", "1.4.7", "1.4.5", "1.4.3", "1.4.2", "1.4.1", "1.3.4", "1.3.3", "1.3.2", "1.3.1", "1.3.0", "1.2.1", "1.2.0", "1.2.rc2", "1.2.rc", "1.1.9", "1.1.8", "1.1.7", "1.1.6", "1.1.5", "1.1.4", "1.1.3", "1.1.2", "1.1.1", "1.1.0", "1.1.pre4", "1.1.pre3", "1.1.pre2", "1.1.pre", "1.1.rc2", "1.1.rc1", "1.1.rc0", "1.0.11", "1.0.10", "1.0.9", "1.0.8", "1.0.7", "1.0.6", "1.0.5", "1.0.4", "1.0.3", "1.0.2", "1.0.1", "1.0.0", "0.9.2", "0.9.1", "0.9.0", "0.8.2", "0.8.1", "0.8.0", "0.7.5", "0.7.4", "0.7.3", "0.7.2", "0.7.1", "0.7.0", "0.6.3", "0.6.2", "0.6.1", "0.6.0", "0.5.6", "0.5.5", "0.5.4", "0.5.3", "0.5.2", "0.5.1", "0.5.0", "0.4.3", "0.4.2", "0.4.1", "0.4.0", "0.3.0", "0.2.3", "0.2.2", "0.2.1", "0.2.0", "0.1.1", "0.1.0"]
Secure versions: [5.0.4]
Recommendation: Update to version 5.0.4.

Devise Gem for Ruby Unauthorized Access Using "Remember Me" Cookie

Published date: 2023-01-26T23:54:07Z
CVE: CVE-2015-8314
Links:

Devise version before 3.5.4 uses cookies to implement a Remember me functionality. However, it generates the same cookie for all devices. If an attacker manages to steal a remember me cookie and the user does not change the password frequently, the cookie can be used to gain access to the application indefinitely.

Affected versions: ["3.5.3", "3.5.2", "3.5.1", "3.4.1", "3.4.0", "3.3.0", "3.2.4", "3.2.3", "3.2.2", "3.2.1", "3.2.0", "3.1.2", "3.1.1", "3.1.0", "3.1.0.rc2", "3.0.4", "3.0.3", "3.0.2", "3.0.1", "3.0.0", "3.0.0.rc", "2.2.8", "2.2.7", "2.2.6", "2.2.5", "2.2.4", "2.2.3", "2.2.2", "2.2.1", "2.2.0", "2.2.0.rc", "2.1.4", "2.1.3", "2.1.2", "2.1.0", "2.1.0.rc2", "2.1.0.rc", "2.0.6", "2.0.5", "2.0.4", "2.0.2", "2.0.1", "2.0.0", "2.0.0.rc2", "2.0.0.rc", "1.5.4", "1.5.3", "1.5.2", "1.5.1", "1.5.0", "1.5.0.rc1", "1.4.9", "1.4.8", "1.4.7", "1.4.5", "1.4.3", "1.4.2", "1.4.1", "1.3.4", "1.3.3", "1.3.2", "1.3.1", "1.3.0", "1.2.1", "1.2.0", "1.2.rc2", "1.2.rc", "1.1.9", "1.1.8", "1.1.7", "1.1.6", "1.1.5", "1.1.4", "1.1.3", "1.1.2", "1.1.1", "1.1.0", "1.1.pre4", "1.1.pre3", "1.1.pre2", "1.1.pre", "1.1.rc2", "1.1.rc1", "1.1.rc0", "1.0.11", "1.0.10", "1.0.9", "1.0.8", "1.0.7", "1.0.6", "1.0.5", "1.0.4", "1.0.3", "1.0.2", "1.0.1", "1.0.0", "0.9.2", "0.9.1", "0.9.0", "0.8.2", "0.8.1", "0.8.0", "0.7.5", "0.7.4", "0.7.3", "0.7.2", "0.7.1", "0.7.0", "0.6.3", "0.6.2", "0.6.1", "0.6.0", "0.5.6", "0.5.5", "0.5.4", "0.5.3", "0.5.2", "0.5.1", "0.5.0", "0.4.3", "0.4.2", "0.4.1", "0.4.0", "0.3.0", "0.2.3", "0.2.2", "0.2.1", "0.2.0", "0.1.1", "0.1.0"]
Secure versions: [5.0.4]
Recommendation: Update to version 5.0.4.

Authentication Bypass in Devise

Published date: 2019-09-11T23:06:57Z
CVE: CVE-2019-16109
Links:

An issue was discovered in Plataformatec Devise before 4.7.1. It confirms accounts upon receiving a request with a blank confirmationtoken, if a database record has a blank value in the confirmationtoken column. (However, there is no scenario within Devise itself in which such database records would exist.)

Affected versions: ["4.7.0", "4.6.2", "4.6.1", "4.6.0", "4.5.0", "4.4.3", "4.4.2", "4.4.1", "4.4.0", "4.3.0", "4.2.1", "4.2.0", "4.1.1", "4.1.0", "4.0.3", "4.0.2", "4.0.1", "4.0.0", "4.0.0.rc2", "4.0.0.rc1", "3.5.10", "3.5.9", "3.5.8", "3.5.7", "3.5.6", "3.5.5", "3.5.4", "3.5.3", "3.5.2", "3.5.1", "3.4.1", "3.4.0", "3.3.0", "3.2.4", "3.2.3", "3.2.2", "3.2.1", "3.2.0", "3.1.2", "3.1.1", "3.1.0", "3.1.0.rc2", "3.0.4", "3.0.3", "3.0.2", "3.0.1", "3.0.0", "3.0.0.rc", "2.2.8", "2.2.7", "2.2.6", "2.2.5", "2.2.4", "2.2.3", "2.2.2", "2.2.1", "2.2.0", "2.2.0.rc", "2.1.4", "2.1.3", "2.1.2", "2.1.0", "2.1.0.rc2", "2.1.0.rc", "2.0.6", "2.0.5", "2.0.4", "2.0.2", "2.0.1", "2.0.0", "2.0.0.rc2", "2.0.0.rc", "1.5.4", "1.5.3", "1.5.2", "1.5.1", "1.5.0", "1.5.0.rc1", "1.4.9", "1.4.8", "1.4.7", "1.4.5", "1.4.3", "1.4.2", "1.4.1", "1.3.4", "1.3.3", "1.3.2", "1.3.1", "1.3.0", "1.2.1", "1.2.0", "1.2.rc2", "1.2.rc", "1.1.9", "1.1.8", "1.1.7", "1.1.6", "1.1.5", "1.1.4", "1.1.3", "1.1.2", "1.1.1", "1.1.0", "1.1.pre4", "1.1.pre3", "1.1.pre2", "1.1.pre", "1.1.rc2", "1.1.rc1", "1.1.rc0", "1.0.11", "1.0.10", "1.0.9", "1.0.8", "1.0.7", "1.0.6", "1.0.5", "1.0.4", "1.0.3", "1.0.2", "1.0.1", "1.0.0", "0.9.2", "0.9.1", "0.9.0", "0.8.2", "0.8.1", "0.8.0", "0.7.5", "0.7.4", "0.7.3", "0.7.2", "0.7.1", "0.7.0", "0.6.3", "0.6.2", "0.6.1", "0.6.0", "0.5.6", "0.5.5", "0.5.4", "0.5.3", "0.5.2", "0.5.1", "0.5.0", "0.4.3", "0.4.2", "0.4.1", "0.4.0", "0.3.0", "0.2.3", "0.2.2", "0.2.1", "0.2.0", "0.1.1", "0.1.0"]
Secure versions: [5.0.4]
Recommendation: Update to version 5.0.4.

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

Published date: 2026-05-08T15:41:47Z
CVE: CVE-2026-40295
Links:

Summary

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.

Details

The vulnerable code is in lib/devise/failure_app.rb:

def redirect_url
  if warden_message == :timeout
    flash[:timedout] = true if is_flashing_format?

    path = if request.get?
      attempted_path          # safe: server-side value from warden options
    else
      request.referrer        # UNSAFE: HTTP Referer header, attacker-controlled
    end

    path || scope_url
  else
    scope_url
  end
end

This is passed directly to redirect_to:

def redirect
  store_location!
  # ...
  redirect_to redirect_url   # redirect_url may be an external attacker URL
end

The GET timeout path uses attempted_path, which is set server-side by Warden and cannot be influenced by the client. The store_location! method also only runs for GET requests, so no session-based protection is applied on POST timeouts.

By contrast, Devise's store_location_for method (used elsewhere) correctly sanitizes URLs via extract_path_from_location, which strips the scheme and host.

Impact

  • Victims with expired sessions who click any attacker-crafted link or visit an attacker page with an auto-submitting form are redirected to an arbitrary external URL.
  • The redirect happens transparently via a trusted domain (the target app's domain), bypassing browser phishing warnings.
  • An attacker can redirect victims to a fake login page to harvest credentials (phishing), or to malicious download sites.

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.

Patches

This is patched in Devise v5.0.4. Users should upgrade as soon as possible.

Workaround

None beyond upgrading. If an upgrade is not immediately possible, the same changes from the patch commit can be applied as a monkey-patch in a Rails initializer (Devise::FailureApp#redirect_url and Devise::Controllers::StoreLocation#extract_path_from_location). Remove the monkey-patch after upgrading.

Affected versions: ["5.0.3", "5.0.2", "5.0.1", "5.0.0", "5.0.0.rc", "4.9.4", "4.9.3", "4.9.2", "4.9.1", "4.9.0", "4.8.1", "4.8.0", "4.7.3", "4.7.2", "4.7.1", "4.7.0", "4.6.2", "4.6.1", "4.6.0", "4.5.0", "4.4.3", "4.4.2", "4.4.1", "4.4.0", "4.3.0", "4.2.1", "4.2.0", "4.1.1", "4.1.0", "4.0.3", "4.0.2", "4.0.1", "4.0.0", "4.0.0.rc2", "4.0.0.rc1", "3.5.10", "3.5.9", "3.5.8", "3.5.7", "3.5.6", "3.5.5", "3.5.4", "3.5.3", "3.5.2", "3.5.1", "3.4.1", "3.4.0", "3.3.0", "3.2.4", "3.2.3", "3.2.2", "3.2.1", "3.2.0", "3.1.2", "3.1.1", "3.1.0", "3.1.0.rc2", "3.0.4", "3.0.3", "3.0.2", "3.0.1", "3.0.0", "3.0.0.rc", "2.2.8", "2.2.7", "2.2.6", "2.2.5", "2.2.4", "2.2.3", "2.2.2", "2.2.1", "2.2.0", "2.2.0.rc", "2.1.4", "2.1.3", "2.1.2", "2.1.0", "2.1.0.rc2", "2.1.0.rc", "2.0.6", "2.0.5", "2.0.4", "2.0.2", "2.0.1", "2.0.0", "2.0.0.rc2", "2.0.0.rc", "1.5.4", "1.5.3", "1.5.2", "1.5.1", "1.5.0", "1.5.0.rc1", "1.4.9", "1.4.8", "1.4.7", "1.4.5", "1.4.3", "1.4.2", "1.4.1", "1.3.4", "1.3.3", "1.3.2", "1.3.1", "1.3.0", "1.2.1", "1.2.0", "1.2.rc2", "1.2.rc", "1.1.9", "1.1.8", "1.1.7", "1.1.6", "1.1.5", "1.1.4", "1.1.3", "1.1.2", "1.1.1", "1.1.0", "1.1.pre4", "1.1.pre3", "1.1.pre2", "1.1.pre", "1.1.rc2", "1.1.rc1", "1.1.rc0", "1.0.11", "1.0.10", "1.0.9", "1.0.8", "1.0.7", "1.0.6", "1.0.5", "1.0.4", "1.0.3", "1.0.2", "1.0.1", "1.0.0", "0.9.2", "0.9.1", "0.9.0", "0.8.2", "0.8.1", "0.8.0", "0.7.5", "0.7.4", "0.7.3", "0.7.2", "0.7.1", "0.7.0", "0.6.3", "0.6.2", "0.6.1", "0.6.0", "0.5.6", "0.5.5", "0.5.4", "0.5.3", "0.5.2", "0.5.1", "0.5.0", "0.4.3", "0.4.2", "0.4.1", "0.4.0", "0.3.0", "0.2.3", "0.2.2", "0.2.1", "0.2.0", "0.1.1", "0.1.0"]
Secure versions: [5.0.4]
Recommendation: Update to version 5.0.4.

Devise Database Type Conversion Crafted Request Parsing Security Bypass

Published date: 2013-01-28
CVE: 2013-0233
CVSS V2: 6.8
Links:

Devise contains a flaw that is triggered during when a type conversion error occurs during the parsing of a malformed request. With a specially crafted request, a remote attacker can bypass security restrictions.

Affected versions: ["1.2.rc", "1.1.7", "1.1.pre3", "1.0.7", "0.9.2", "0.7.2", "0.6.3", "0.6.0", "0.5.6", "2.2.2", "1.4.2", "1.1.3", "1.1.2", "1.1.0", "1.1.pre4", "0.9.0", "0.7.0", "0.5.1", "0.4.2", "0.3.0", "1.2.0", "1.1.8", "1.1.rc2", "1.1.pre", "1.0.11", "1.0.8", "1.0.4", "0.8.1", "0.7.4", "0.6.2", "1.4.7", "1.0.9", "1.0.3", "1.0.2", "1.0.0", "0.8.0", "0.7.5", "0.7.3", "0.5.4", "0.4.3", "0.2.3", "0.2.1", "0.5.3", "2.2.1", "1.4.5", "1.4.3", "1.1.6", "1.1.4", "0.5.5", "0.5.0", "0.4.1", "0.4.0", "0.1.0", "2.2.0.rc", "1.4.8", "1.3.1", "1.2.1", "1.1.5", "1.1.rc0", "0.7.1", "0.5.2", "0.2.0", "1.4.9", "1.3.3", "1.3.0", "1.2.rc2", "1.1.9", "1.1.1", "1.1.rc1", "1.0.10", "1.0.6", "0.9.1", "0.8.2", "0.1.1", "2.2.0", "1.4.1", "1.3.4", "1.3.2", "1.1.pre2", "1.0.5", "1.0.1", "0.6.1", "0.2.2"]
Secure versions: [5.0.4]
Recommendation: Update to version 5.0.4.

Devise Gem for Ruby Unauthorized Access Using Remember Me Cookie

Published date: 2016-01-18
CVE: 2015-8314
CVSS V3: 7.5
Links:

Devise version before 3.5.4 uses cookies to implement a Remember me functionality. However, it generates the same cookie for all devices. If an attacker manages to steal a remember me cookie and the user does not change the password frequently, the cookie can be used to gain access to the application indefinitely.

Affected versions: ["3.0.2", "2.2.6", "2.1.2", "2.1.0", "2.0.5", "1.5.4", "1.5.2", "1.5.1", "1.2.rc", "1.1.7", "1.1.pre3", "1.0.7", "0.9.2", "0.7.2", "0.6.3", "0.6.0", "0.5.6", "3.4.1", "2.2.2", "2.1.4", "2.1.0.rc", "1.4.2", "1.1.3", "1.1.2", "1.1.0", "1.1.pre4", "0.9.0", "0.7.0", "0.5.1", "0.4.2", "0.3.0", "3.4.0", "3.2.4", "3.0.4", "2.0.0.rc", "1.2.0", "1.1.8", "1.1.rc2", "1.1.pre", "1.0.11", "1.0.8", "1.0.4", "0.8.1", "0.7.4", "0.6.2", "3.5.2", "3.5.1", "3.3.0", "3.2.0", "3.1.2", "3.1.0.rc2", "2.2.8", "2.2.5", "2.2.4", "1.5.0", "1.4.7", "1.0.9", "1.0.3", "1.0.2", "1.0.0", "0.8.0", "0.7.5", "0.7.3", "0.5.4", "0.4.3", "0.2.3", "0.2.1", "0.5.3", "3.2.2", "3.0.3", "2.2.7", "2.2.1", "2.1.0.rc2", "2.0.1", "2.0.0", "1.5.3", "1.4.5", "1.4.3", "1.1.6", "1.1.4", "0.5.5", "0.5.0", "0.4.1", "0.4.0", "0.1.0", "3.5.3", "3.1.0", "3.0.1", "3.0.0", "2.2.0.rc", "1.4.8", "1.3.1", "1.2.1", "1.1.5", "1.1.rc0", "0.7.1", "0.5.2", "0.2.0", "3.2.1", "2.2.3", "2.1.3", "2.0.6", "2.0.4", "2.0.2", "1.4.9", "1.3.3", "1.3.0", "1.2.rc2", "1.1.9", "1.1.1", "1.1.rc1", "1.0.10", "1.0.6", "0.9.1", "0.8.2", "0.1.1", "3.2.3", "3.1.1", "3.0.0.rc", "2.2.0", "2.0.0.rc2", "1.5.0.rc1", "1.4.1", "1.3.4", "1.3.2", "1.1.pre2", "1.0.5", "1.0.1", "0.6.1", "0.2.2"]
Secure versions: [5.0.4]
Recommendation: Update to version 5.0.4.

Devise Gem for Ruby confirmation token validation with a blank string

Published date: 2019-09-08
CVE: 2019-16109
CVSS V3: 5.3
Links:

Devise before 4.7.1 confirms accounts upon receiving a request with a blank confirmationtoken, if a database record has a blank value in the confirmationtoken column. However, there is no scenario within Devise itself in which such database records would exist.

Affected versions: ["4.1.0", "4.0.3", "3.0.2", "2.2.6", "2.1.2", "2.1.0", "2.0.5", "1.5.4", "1.5.2", "1.5.1", "1.2.rc", "1.1.7", "1.1.pre3", "1.0.7", "0.9.2", "4.7.0", "4.6.0", "4.0.0", "0.7.2", "0.6.3", "0.6.0", "0.5.6", "4.5.0", "3.5.8", "3.4.1", "2.2.2", "2.1.4", "2.1.0.rc", "1.4.2", "1.1.3", "1.1.2", "1.1.0", "1.1.pre4", "0.9.0", "0.7.0", "0.5.1", "0.4.2", "0.3.0", "3.5.7", "3.4.0", "3.2.4", "3.0.4", "2.0.0.rc", "1.2.0", "1.1.8", "1.1.rc2", "1.1.pre", "1.0.11", "1.0.8", "1.0.4", "0.8.1", "0.7.4", "0.6.2", "4.6.1", "4.4.3", "4.4.1", "4.6.2", "4.0.1", "3.5.2", "3.5.1", "3.3.0", "3.2.0", "3.1.2", "3.1.0.rc2", "2.2.8", "2.2.5", "2.2.4", "1.5.0", "1.4.7", "1.0.9", "1.0.3", "1.0.2", "1.0.0", "0.8.0", "0.7.5", "0.7.3", "0.5.4", "0.4.3", "0.2.3", "0.2.1", "4.4.2", "0.5.3", "4.3.0", "3.5.9", "3.2.2", "3.0.3", "2.2.7", "2.2.1", "2.1.0.rc2", "2.0.1", "2.0.0", "1.5.3", "1.4.5", "1.4.3", "1.1.6", "1.1.4", "0.5.5", "0.5.0", "0.4.1", "0.4.0", "0.1.0", "4.1.1", "4.0.2", "4.0.0.rc2", "3.5.6", "3.5.5", "3.5.3", "3.1.0", "3.0.1", "3.0.0", "2.2.0.rc", "1.4.8", "1.3.1", "1.2.1", "1.1.5", "1.1.rc0", "0.7.1", "0.5.2", "0.2.0", "4.4.0", "4.2.1", "4.2.0", "4.0.0.rc1", "3.5.4", "3.2.1", "2.2.3", "2.1.3", "2.0.6", "2.0.4", "2.0.2", "1.4.9", "1.3.3", "1.3.0", "1.2.rc2", "1.1.9", "1.1.1", "1.1.rc1", "1.0.10", "1.0.6", "0.9.1", "0.8.2", "0.1.1", "3.5.10", "3.2.3", "3.1.1", "3.0.0.rc", "2.2.0", "2.0.0.rc2", "1.5.0.rc1", "1.4.1", "1.3.4", "1.3.2", "1.1.pre2", "1.0.5", "1.0.1", "0.6.1", "0.2.2"]
Secure versions: [5.0.4]
Recommendation: Update to version 5.0.4.

Devise Gem for Ruby Time-of-check Time-of-use race condition with lockable module

Published date: 2019-02-07
CVE: 2019-5421
CVSS V2: 7.5
CVSS V3: 9.8
Links:

Devise ruby gem before 4.6.0 when the lockable module is used is vulnerable to a time-of-check time-of-use (TOCTOU) race condition due to increment_failed_attempts within the Devise::Models::Lockable class not being concurrency safe.

Affected versions: ["4.1.0", "4.0.3", "3.0.2", "2.2.6", "2.1.2", "2.1.0", "2.0.5", "1.5.4", "1.5.2", "1.5.1", "1.2.rc", "1.1.7", "1.1.pre3", "1.0.7", "0.9.2", "4.0.0", "0.7.2", "0.6.3", "0.6.0", "0.5.6", "4.5.0", "3.5.8", "3.4.1", "2.2.2", "2.1.4", "2.1.0.rc", "1.4.2", "1.1.3", "1.1.2", "1.1.0", "1.1.pre4", "0.9.0", "0.7.0", "0.5.1", "0.4.2", "0.3.0", "3.5.7", "3.4.0", "3.2.4", "3.0.4", "2.0.0.rc", "1.2.0", "1.1.8", "1.1.rc2", "1.1.pre", "1.0.11", "1.0.8", "1.0.4", "0.8.1", "0.7.4", "0.6.2", "4.4.3", "4.4.1", "4.0.1", "3.5.2", "3.5.1", "3.3.0", "3.2.0", "3.1.2", "3.1.0.rc2", "2.2.8", "2.2.5", "2.2.4", "1.5.0", "1.4.7", "1.0.9", "1.0.3", "1.0.2", "1.0.0", "0.8.0", "0.7.5", "0.7.3", "0.5.4", "0.4.3", "0.2.3", "0.2.1", "4.4.2", "0.5.3", "4.3.0", "3.5.9", "3.2.2", "3.0.3", "2.2.7", "2.2.1", "2.1.0.rc2", "2.0.1", "2.0.0", "1.5.3", "1.4.5", "1.4.3", "1.1.6", "1.1.4", "0.5.5", "0.5.0", "0.4.1", "0.4.0", "0.1.0", "4.1.1", "4.0.2", "4.0.0.rc2", "3.5.6", "3.5.5", "3.5.3", "3.1.0", "3.0.1", "3.0.0", "2.2.0.rc", "1.4.8", "1.3.1", "1.2.1", "1.1.5", "1.1.rc0", "0.7.1", "0.5.2", "0.2.0", "4.4.0", "4.2.1", "4.2.0", "4.0.0.rc1", "3.5.4", "3.2.1", "2.2.3", "2.1.3", "2.0.6", "2.0.4", "2.0.2", "1.4.9", "1.3.3", "1.3.0", "1.2.rc2", "1.1.9", "1.1.1", "1.1.rc1", "1.0.10", "1.0.6", "0.9.1", "0.8.2", "0.1.1", "3.5.10", "3.2.3", "3.1.1", "3.0.0.rc", "2.2.0", "2.0.0.rc2", "1.5.0.rc1", "1.4.1", "1.3.4", "1.3.2", "1.1.pre2", "1.0.5", "1.0.1", "0.6.1", "0.2.2"]
Secure versions: [5.0.4]
Recommendation: Update to version 5.0.4.

Confirmable "change email" race condition permits user to confirm email they have no access to

Published date: 2026-03-16
CVE: 2026-32700
CVSS V3: 5.3
Links:

Impact

A race condition in Devise's Confirmable module allows an attacker to confirm an email address they do not own. This affects any Devise application using the reconfirmable option (the default when using Confirmable with email changes).

By sending two concurrent email change requests, an attacker can desynchronize the confirmationtoken and unconfirmedemail fields. The confirmation token is sent to an email the attacker controls, but the unconfirmed_email in the database points to a victim's email address. When the attacker uses the token, the victim's email is confirmed on the attacker's account.

Patch

This is patched in Devise v5.0.3. Users should upgrade as soon as possible.

Workaround

Applications can override this specific method from Devise models to force unconfirmed_email to be persisted when unchanged: (assuming your model is User)

class User < ApplicationRecord
  protected

  def postpone_email_change_until_confirmation_and_regenerate_confirmation_token
    unconfirmed_email_will_change!
    super
  end
end

Note: Mongoid does not seem to respect that willchange! should force the attribute to be persisted, even if it did not really change, so you might have to implement a workaround similar to Devise by setting changedattributes[unconfirmed_email] = nil as well.

Affected versions: ["4.1.0", "4.0.3", "3.0.2", "2.2.6", "2.1.2", "2.1.0", "2.0.5", "1.5.4", "1.5.2", "1.5.1", "1.2.rc", "1.1.7", "1.1.pre3", "1.0.7", "0.9.2", "4.7.0", "4.6.0", "4.0.0", "0.7.2", "0.6.3", "0.6.0", "0.5.6", "4.5.0", "3.5.8", "3.4.1", "2.2.2", "2.1.4", "2.1.0.rc", "1.4.2", "1.1.3", "1.1.2", "1.1.0", "1.1.pre4", "0.9.0", "0.7.0", "0.5.1", "0.4.2", "0.3.0", "3.5.7", "3.4.0", "3.2.4", "3.0.4", "2.0.0.rc", "1.2.0", "1.1.8", "1.1.rc2", "1.1.pre", "1.0.11", "1.0.8", "1.0.4", "0.8.1", "0.7.4", "0.6.2", "4.6.1", "4.4.3", "4.4.1", "4.6.2", "4.0.1", "3.5.2", "3.5.1", "3.3.0", "3.2.0", "3.1.2", "3.1.0.rc2", "2.2.8", "2.2.5", "2.2.4", "1.5.0", "1.4.7", "1.0.9", "1.0.3", "1.0.2", "1.0.0", "0.8.0", "0.7.5", "0.7.3", "0.5.4", "0.4.3", "0.2.3", "0.2.1", "4.7.3", "4.4.2", "0.5.3", "4.7.2", "4.7.1", "4.3.0", "3.5.9", "3.2.2", "3.0.3", "2.2.7", "2.2.1", "2.1.0.rc2", "2.0.1", "2.0.0", "1.5.3", "1.4.5", "1.4.3", "1.1.6", "1.1.4", "0.5.5", "0.5.0", "0.4.1", "0.4.0", "0.1.0", "4.1.1", "4.0.2", "4.0.0.rc2", "3.5.6", "3.5.5", "3.5.3", "3.1.0", "3.0.1", "3.0.0", "2.2.0.rc", "1.4.8", "1.3.1", "1.2.1", "1.1.5", "1.1.rc0", "0.7.1", "0.5.2", "0.2.0", "4.4.0", "4.2.1", "4.2.0", "4.0.0.rc1", "3.5.4", "3.2.1", "2.2.3", "2.1.3", "2.0.6", "2.0.4", "2.0.2", "1.4.9", "1.3.3", "1.3.0", "1.2.rc2", "1.1.9", "1.1.1", "1.1.rc1", "1.0.10", "1.0.6", "0.9.1", "0.8.2", "0.1.1", "3.5.10", "3.2.3", "3.1.1", "3.0.0.rc", "2.2.0", "2.0.0.rc2", "1.5.0.rc1", "1.4.1", "1.3.4", "1.3.2", "1.1.pre2", "1.0.5", "1.0.1", "0.6.1", "0.2.2", "4.8.0", "4.8.1", "4.9.0", "4.9.1", "4.9.2", "4.9.3", "4.9.4", "5.0.0.rc", "5.0.0", "5.0.1", "5.0.2"]
Secure versions: [5.0.4]
Recommendation: Update to version 5.0.4.

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

Published date: 2026-05-08
CVE: 2026-40295
CVSS V3: 6.1
Links:

Summary

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.

Details

The vulnerable code is in lib/devise/failure_app.rb:

def redirect_url
  if warden_message == :timeout
    flash[:timedout] = true if is_flashing_format?

    path = if request.get?
      attempted_path          # safe: server-side value from warden options
    else
      request.referrer        # UNSAFE: HTTP Referer header, attacker-controlled
    end

    path || scope_url
  else
    scope_url
  end
end

This is passed directly to redirect_to:

def redirect
  store_location!
  # ...
  redirect_to redirect_url   # redirect_url may be an external attacker URL
end

The GET timeout path uses attempted_path, which is set server-side by Warden and cannot be influenced by the client. The store_location! method also only runs for GET requests, so no session-based protection is applied on POST timeouts.

By contrast, Devise's store_location_for method (used elsewhere) correctly sanitizes URLs via extract_path_from_location, which strips the scheme and host.

Impact

  • Victims with expired sessions who click any attacker-crafted link or visit an attacker page with an auto-submitting form are redirected to an arbitrary external URL.
  • The redirect happens transparently via a trusted domain (the target app's domain), bypassing browser phishing warnings.
  • An attacker can redirect victims to a fake login page to harvest credentials (phishing), or to malicious download sites.

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.

Patches

This is patched in Devise v5.0.4. Users should upgrade as soon as possible.

Workaround

None beyond upgrading. If an upgrade is not immediately possible, the same changes from the patch commit can be applied as a monkey-patch in a Rails initializer (Devise::FailureApp#redirect_url and Devise::Controllers::StoreLocation#extract_path_from_location). Remove the monkey-patch after upgrading.

Affected versions: ["4.1.0", "4.0.3", "3.0.2", "2.2.6", "2.1.2", "2.1.0", "2.0.5", "1.5.4", "1.5.2", "1.5.1", "1.2.rc", "1.1.7", "1.1.pre3", "1.0.7", "0.9.2", "4.7.0", "4.6.0", "4.0.0", "0.7.2", "0.6.3", "0.6.0", "0.5.6", "4.5.0", "3.5.8", "3.4.1", "2.2.2", "2.1.4", "2.1.0.rc", "1.4.2", "1.1.3", "1.1.2", "1.1.0", "1.1.pre4", "0.9.0", "0.7.0", "0.5.1", "0.4.2", "0.3.0", "3.5.7", "3.4.0", "3.2.4", "3.0.4", "2.0.0.rc", "1.2.0", "1.1.8", "1.1.rc2", "1.1.pre", "1.0.11", "1.0.8", "1.0.4", "0.8.1", "0.7.4", "0.6.2", "4.6.1", "4.4.3", "4.4.1", "4.6.2", "4.0.1", "3.5.2", "3.5.1", "3.3.0", "3.2.0", "3.1.2", "3.1.0.rc2", "2.2.8", "2.2.5", "2.2.4", "1.5.0", "1.4.7", "1.0.9", "1.0.3", "1.0.2", "1.0.0", "0.8.0", "0.7.5", "0.7.3", "0.5.4", "0.4.3", "0.2.3", "0.2.1", "4.7.3", "4.4.2", "0.5.3", "4.7.2", "4.7.1", "4.3.0", "3.5.9", "3.2.2", "3.0.3", "2.2.7", "2.2.1", "2.1.0.rc2", "2.0.1", "2.0.0", "1.5.3", "1.4.5", "1.4.3", "1.1.6", "1.1.4", "0.5.5", "0.5.0", "0.4.1", "0.4.0", "0.1.0", "4.1.1", "4.0.2", "4.0.0.rc2", "3.5.6", "3.5.5", "3.5.3", "3.1.0", "3.0.1", "3.0.0", "2.2.0.rc", "1.4.8", "1.3.1", "1.2.1", "1.1.5", "1.1.rc0", "0.7.1", "0.5.2", "0.2.0", "4.4.0", "4.2.1", "4.2.0", "4.0.0.rc1", "3.5.4", "3.2.1", "2.2.3", "2.1.3", "2.0.6", "2.0.4", "2.0.2", "1.4.9", "1.3.3", "1.3.0", "1.2.rc2", "1.1.9", "1.1.1", "1.1.rc1", "1.0.10", "1.0.6", "0.9.1", "0.8.2", "0.1.1", "3.5.10", "3.2.3", "3.1.1", "3.0.0.rc", "2.2.0", "2.0.0.rc2", "1.5.0.rc1", "1.4.1", "1.3.4", "1.3.2", "1.1.pre2", "1.0.5", "1.0.1", "0.6.1", "0.2.2", "4.8.0", "4.8.1", "4.9.0", "4.9.1", "4.9.2", "4.9.3", "4.9.4", "5.0.0.rc", "5.0.0", "5.0.1", "5.0.2", "5.0.3"]
Secure versions: [5.0.4]
Recommendation: Update to version 5.0.4.

CSRF token fixation attacks in Devise

Published date: 2013-08-02
Links:

Devise contains a flaw that allows a remote, user-assisted attacker to conduct a CSRF token fixation attack. This issue is triggered as previous CSRF tokens are not properly invalidated when a new token is created. If an attacker has knowledge of said token, a specially crafted request can be made to it, allowing the attacker to conduct CSRF attacks.

Affected versions: ["2.1.2", "2.1.0", "2.0.5", "1.5.4", "1.5.2", "1.5.1", "1.2.rc", "1.1.7", "1.1.pre3", "1.0.7", "0.9.2", "0.7.2", "0.6.3", "0.6.0", "0.5.6", "2.1.4", "2.1.0.rc", "1.4.2", "1.1.3", "1.1.2", "1.1.0", "1.1.pre4", "0.9.0", "0.7.0", "0.5.1", "0.4.2", "0.3.0", "2.0.0.rc", "1.2.0", "1.1.8", "1.1.rc2", "1.1.pre", "1.0.11", "1.0.8", "1.0.4", "0.8.1", "0.7.4", "0.6.2", "1.5.0", "1.4.7", "1.0.9", "1.0.3", "1.0.2", "1.0.0", "0.8.0", "0.7.5", "0.7.3", "0.5.4", "0.4.3", "0.2.3", "0.2.1", "0.5.3", "2.1.0.rc2", "2.0.1", "2.0.0", "1.5.3", "1.4.5", "1.4.3", "1.1.6", "1.1.4", "0.5.5", "0.5.0", "0.4.1", "0.4.0", "0.1.0", "3.0.0", "1.4.8", "1.3.1", "1.2.1", "1.1.5", "1.1.rc0", "0.7.1", "0.5.2", "0.2.0", "2.1.3", "2.0.6", "2.0.4", "2.0.2", "1.4.9", "1.3.3", "1.3.0", "1.2.rc2", "1.1.9", "1.1.1", "1.1.rc1", "1.0.10", "1.0.6", "0.9.1", "0.8.2", "0.1.1", "3.0.0.rc", "2.0.0.rc2", "1.5.0.rc1", "1.4.1", "1.3.4", "1.3.2", "1.1.pre2", "1.0.5", "1.0.1", "0.6.1", "0.2.2"]
Secure versions: [5.0.4]
Recommendation: Update to version 5.0.4.

173 Other Versions

Version License Security Released
3.2.3 MIT 10 2014-02-20 - 18:33 about 12 years
3.2.2 MIT 10 2013-11-25 - 11:00 over 12 years
3.2.1 MIT 10 2013-11-13 - 13:25 over 12 years
3.2.0 MIT 10 2013-11-06 - 20:51 over 12 years
3.1.2 MIT 10 2013-11-13 - 13:24 over 12 years
3.1.1 MIT 10 2013-10-01 - 15:51 over 12 years
3.1.0 MIT 10 2013-09-05 - 22:50 over 12 years
3.1.0.rc2 MIT 10 2013-08-18 - 08:18 almost 13 years
3.0.4 MIT 10 2013-11-13 - 13:24 over 12 years
3.0.3 MIT 10 2013-08-18 - 08:26 almost 13 years
3.0.2 MIT 10 2013-08-09 - 08:24 almost 13 years
3.0.1 MIT 10 2013-08-02 - 21:25 almost 13 years
3.0.0 MIT 11 2013-07-14 - 18:48 almost 13 years
3.0.0.rc MIT 11 2013-05-07 - 16:35 about 13 years
2.2.8 MIT 10 2013-11-13 - 13:24 over 12 years
2.2.7 MIT 10 2013-08-18 - 08:29 almost 13 years
2.2.6 MIT 10 2013-08-09 - 08:32 almost 13 years
2.2.5 MIT 10 2013-08-02 - 21:24 almost 13 years
2.2.4 MIT 10 2013-05-07 - 15:54 about 13 years
2.2.3 UNKNOWN 10 2013-01-28 - 14:49 over 13 years
2.2.2 UNKNOWN 12 2013-01-15 - 20:03 over 13 years
2.2.1 UNKNOWN 12 2013-01-11 - 18:16 over 13 years
2.2.0 UNKNOWN 12 2013-01-08 - 20:31 over 13 years
2.2.0.rc UNKNOWN 11 2012-12-13 - 09:05 over 13 years
2.1.4 UNKNOWN 11 2013-08-18 - 08:38 almost 13 years
2.1.3 UNKNOWN 11 2013-01-28 - 14:49 over 13 years
2.1.2 UNKNOWN 12 2012-06-19 - 09:27 almost 14 years
2.1.0 UNKNOWN 12 2012-05-15 - 17:16 about 14 years
2.1.0.rc2 UNKNOWN 11 2012-05-09 - 22:54 about 14 years
2.1.0.rc UNKNOWN 11 2012-03-15 - 14:19 about 14 years
2.0.6 UNKNOWN 11 2013-08-18 - 08:44 almost 13 years
2.0.5 UNKNOWN 11 2013-01-28 - 14:49 over 13 years
2.0.4 UNKNOWN 12 2012-02-17 - 08:32 over 14 years
2.0.2 UNKNOWN 12 2012-02-15 - 16:26 over 14 years
2.0.1 UNKNOWN 12 2012-02-09 - 10:15 over 14 years
2.0.0 UNKNOWN 12 2012-01-26 - 19:45 over 14 years
2.0.0.rc2 UNKNOWN 11 2012-01-24 - 13:29 over 14 years
2.0.0.rc UNKNOWN 11 2011-12-19 - 12:36 over 14 years
1.5.4 UNKNOWN 11 2013-01-28 - 14:49 over 13 years
1.5.3 UNKNOWN 12 2011-12-19 - 11:57 over 14 years
1.5.2 UNKNOWN 12 2011-11-30 - 09:26 over 14 years
1.5.1 UNKNOWN 12 2011-11-22 - 15:13 over 14 years
1.5.0 UNKNOWN 12 2011-11-13 - 21:23 over 14 years
1.5.0.rc1 UNKNOWN 11 2011-11-10 - 21:27 over 14 years
1.4.9 UNKNOWN 12 2011-10-20 - 14:50 over 14 years
1.4.8 UNKNOWN 12 2011-10-10 - 12:44 over 14 years
1.4.7 UNKNOWN 12 2011-09-22 - 09:51 over 14 years
1.4.5 UNKNOWN 12 2011-09-08 - 21:54 over 14 years
1.4.3 UNKNOWN 12 2011-08-30 - 12:43 over 14 years
1.4.2 UNKNOWN 12 2011-06-30 - 18:20 almost 15 years