GHSA-57hq-95w6-v4fc

Suggest an improvement
Source
https://github.com/advisories/GHSA-57hq-95w6-v4fc
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/03/GHSA-57hq-95w6-v4fc/GHSA-57hq-95w6-v4fc.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-57hq-95w6-v4fc
Aliases
Downstream
Published
2026-03-17T17:24:17Z
Modified
2026-03-30T14:05:52Z
Severity
  • 5.3 (Medium) CVSS_V3 - CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:N CVSS Calculator
  • 6.0 (Medium) CVSS_V4 - CVSS:4.0/AV:N/AC:H/AT:N/PR:L/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N CVSS Calculator
Summary
Devise has a confirmable "change email" race condition permits user to confirm email they have no access to
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
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.

Database specific
{
    "cwe_ids": [
        "CWE-362"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-03-17T17:24:17Z",
    "nvd_published_at": "2026-03-18T21:16:26Z",
    "severity": "MODERATE"
}
References

Affected packages

RubyGems / devise

Package

Name
devise
Purl
pkg:gem/devise

Affected ranges

Type
ECOSYSTE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
4.4.3
4.5.0
4.6.0
4.6.1
4.6.2
4.7.0
4.7.1
4.7.2
4.7.3
4.8.0
4.8.1
4.9.0
4.9.1
4.9.2
4.9.3
4.9.4
5.*
5.0.0.rc
5.0.0
5.0.1
5.0.2

Database specific

last_known_affected_version_range
"<= 5.0.2"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/03/GHSA-57hq-95w6-v4fc/GHSA-57hq-95w6-v4fc.json"