6.0medium
Devise has a confirmable "change email" race condition that permits user to confirm email they have no access to
- Severity
- 6.0medium CVSS:4.0 by GitHub_M
- Exploit likelihood
- 0.30% (higher than 25% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-57hq-95w6-v4fc
Description
Devise is an authentication solution for Rails based on Warden. Prior to version 5.0.3, 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. This is patched in Devise v5.0.3. Users should upgrade as soon as possible. As a workaround, applications can override a specific method from Devise models to force `unconfirmed_email` to be persisted when unchanged. Note that Mongoid does not seem to respect that `will_change!` should force the attribute to be persisted, even if it did not really change, so the user might have to implement a workaround similar to Devise by setting `changed_attributes["unconfirmed_email"] = nil` as well.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| heartcombo devise | < 5.0.3, before 5.0.3 | CVE List, NVD |
| devise (RubyGems) | before 5.0.3 | GitHub Advisory Database |
All scores
| GitHub_M | 6.0medium CVSS:4.0 | 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 |
| GitHub | 5.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:N |
| GitHub | medium CVSS:4.0 | 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 |
| NVD | 5.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:N/I:H/A:N |
Classification
SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.
What each source says
CVE List
Devise is an authentication solution for Rails based on Warden. Prior to version 5.0.3, 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. This is patched in Devise v5.0.3. Users should upgrade as soon as possible. As a workaround, applications can override a specific method from Devise models to force `unconfirmed_email` to be persisted when unchanged. Note that Mongoid does not seem to respect that `will_change!` should force the attribute to be persisted, even if it did not really change, so the user might have to implement a workaround similar to Devise by setting `changed_attributes["unconfirmed_email"] = nil` as well.
GitHub Advisory Database
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.
NVD (es)
Devise es una solución de autenticación para Rails basada en Warden. Antes de la versión 5.0.3, una condición de carrera en el módulo Confirmable de Devise permite a un atacante confirmar una dirección de correo electrónico que no posee. Esto afecta a cualquier aplicación Devise que utilice la opción 'reconfirmable' (la predeterminada al usar Confirmable con cambios de correo electrónico). Al enviar dos solicitudes concurrentes de cambio de correo electrónico, un atacante puede desincronizar los campos `confirmation_token` y `unconfirmed_email`. El token de confirmación se envía a un correo electrónico que el atacante controla, pero el `unconfirmed_email` en la base de datos apunta a la dirección de correo electrónico de una víctima. Cuando el atacante utiliza el token, el correo electrónico de la víctima se confirma en la cuenta del atacante. Esto está parcheado en Devise v5.0.3. Los usuarios deben actualizar lo antes posible. Como solución alternativa, las aplicaciones pueden sobrescribir un método específico de los modelos de Devise para forzar que `unconfirmed_email` se persista cuando no ha cambiado. Tenga en cuenta que Mongoid no parece respetar que `will_change!` debería forzar que el atributo se persista, incluso si realmente no cambió, por lo que el usuario podría tener que implementar una solución alternativa similar a Devise estableciendo `changed_attributes["unconfirmed_email"] = nil` también.
References
| https://github.com/heartcombo/devise/security/advisories/GHSA-57hq-95w6-v4fc | vendor-advisory, web | |
| https://github.com/heartcombo/devise/issues/5783 | exploit, issue-tracking, web | |
| https://github.com/heartcombo/devise/pull/5784 | issue-tracking, patch, web | |
| https://github.com/rubysec/ruby-advisory-db/blob/master/gems/devise/GHSA-57hq-95w6-v4fc.yml | broken-link, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-32700 | advisory | |
| https://github.com/heartcombo/devise | package | |
| https://github.com/rubysec/ruby-advisory-db/blob/master/gems/devise/CVE-2026-32700.yml | web | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-32700 changed 2026-03-20 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-57hq-95w6-v4fc changed 2026-03-30 | CC-BY-4.0 |
| NVD | CVE-2026-32700 changed 2026-06-17 | Public domain |