Devise has a confirmable "change email" race condition permits user to confirm email they have no access to
Published 17 Mar 2026 · Updated 30 Mar 2026
Is your project on an affected devise?
Look after several Rails or Ruby apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Affected package
- Affected
- <5.0.3
- Fixed in
- 5.0.3
bundle update --conservative devise # Gemfile: '>= 5.0.3'Details
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
endNote: 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.
Is GHSA-57hq-95w6-v4fc in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected devise, and gives you the command that fixes it.
More advisories for devise
- MediumCVE-2026-40295Devise has an Open Redirect via Unvalidated `request.referrer` in Timeoutable Session Timeout Handler · 8 May 2026
- HighCVE-2015-8314Devise Gem for Ruby Unauthorized Access Using "Remember Me" Cookie · 26 Jan 2023
- MediumCVE-2019-16109Authentication Bypass in Devise · 11 Sept 2019
- MediumCVE-2019-5421devise Time-of-check Time-of-use Race Condition vulnerability · 19 Mar 2019
- MediumCVE-2013-0233Devise does not properly perform type conversion when performing database queries · 24 Oct 2017
References
- Linkgithub.com/heartcombo/devise/security/advisories/GHSA-57hq-95w6-v4fc
- Advisorynvd.nist.gov/vuln/detail/CVE-2026-32700
- Linkgithub.com/heartcombo/devise/issues/5783
- Linkgithub.com/heartcombo/devise/pull/5784
- Packagegithub.com/heartcombo/devise
- Linkgithub.com/rubysec/ruby-advisory-db/blob/master/gems/devise/CVE-2026-32700.yml
- Linkgithub.com/rubysec/ruby-advisory-db/blob/master/gems/devise/GHSA-57hq-95w6-v4fc.yml
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.