GHSA-PCX2-9RWJ-RJ4R
Account takeover via password reset due to collation-dependent email lookup (accent/case-insensitive) without normalization or byte-exact re-check
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:L
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-PCX2-9RWJ-RJ4R divulgada · CVSS 7.7 (GitHub) | |
| Divulgación | Modificada | Última actualización del registro | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
When `security.password_reset.enabled` is set to `true`, an unauthenticated attacker who controls a mailbox that differs from a victim's stored email address only by accents or letter case can receive the victim's password reset link and take over the victim's SQL-authenticated account, including superuser accounts.
On MySQL/MariaDB installations using the default accent- and case-insensitive collation (e.g. `utf8mb4_0900_ai_ci` on MySQL 8.x), `DbUserRepository::getUserByEmail()` resolves `WHERE users.email = :email` with that collation, so a submitted `jose@gmail.com` matches a stored `josé@gmail.com`. The reset email is sent to the submitted address (the attacker's mailbox) and `PasswordResetService::validateToken()` re-resolves the account using the same collation-dependent comparison without any byte-exact re-check.
The maintainer has already fixed this class of bug for username lookup (`DbUserRepository::findByUsername()`) and OIDC/SAML provisioning via `DbCompat::accentSensitiveEquals()` (see GHSA-cmwh-g2h8-c222), but the password reset flow was not covered.
Details
Code path:
- Public, unauthenticated endpoint POST `/password/forgot` (`ForgotPasswordController`, constructed with no authentication required). The submitted email is only trimmed and checked with `filter_var(FILTER_VALIDATE_EMAIL)`; no normalization (lowercasing or Unicode NFC) is applied before the lookup.
- `PasswordResetService::canUserResetPassword()` / `createResetRequest()` resolve the account via `DbUserRepository::getUserByEmail()`: `SELECT users.* ... WHERE users.email = :email LIMIT 1`, a plain comparison whose result depends on the column collation. The `users.email` column is declared without an explicit COLLATE (`sql/poweradmin-mysql-db-structure.sql`), so it inherits the server default, which is accent-insensitive and case-insensitive on MySQL 8.x (`utf8mb4_0900_ai_ci`) and MariaDB (`uca1400_ai_ci`).
- The token row stores the submitted email and the reset link is sent to that address: `sendResetEmail($email, ...)` where `$email` is the attacker-submitted value. No user id is embedded in the link; account resolution happens at validation time.
- On `/password/reset?token=...`, `validateToken()` re-runs `getUserByEmail($tokenData['email'])` (same collation-dependent comparison). The only guards are `countUsersByEmail(...) > 1` (also collation-dependent, equals 1 in this scenario) and the external auth method check. There is no byte-exact re-check of the stored email against the token's email.
- `resetPassword()` then runs `UPDATE users SET password = ? WHERE id = ?` on the victim's row.
Verified empirically with mysql:8.4 using the exact schema from `sql/poweradmin-mysql-db-structure.sql`: inserting a user with email `josé@gmail.com`, then running `SELECT id FROM users WHERE email = 'jose@gmail.com';` returns that user's row (same for case variants). On PHP 8.3/8.4, `filter_var('josé@gmail.com', FILTER_VALIDATE_EMAIL)` is `false`, so the attacker submits the ASCII variant while the stored victim email may be accented.
PoC
Preconditions: `security.password_reset.enabled = true`; MySQL/MariaDB backend with default collation; victim account using SQL auth (`auth_method='sql'`) whose stored email has an ownable accent or case variant (e.g. `josé@gmail.com`).
- The attacker owns the mailbox `jose@gmail.com` and submits the public `/password/forgot` form with `email=jose@gmail.com`.
- The lookup resolves the victim's row; a token is created for `jose@gmail.com` and the reset link is emailed to `jose@gmail.com` (the attacker).
- The attacker opens `/password/reset?token=...`; validation re-resolves the victim's row (count guard = 1, auth method = sql) and accepts the token.
- The attacker sets a new password; the victim's account password is updated.
- The attacker logs in with the victim's username and the new password: full session, including superuser if the victim is one (no superuser exclusion exists in this flow).
Impact
Unauthenticated account takeover of any SQL-authenticated account whose stored email has an ownable variant, including superusers. With a superuser account: full control of Poweradmin and of all managed DNS zones (MX/SPF/DKIM hijack, ACME records, user management).
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Packagistpoweradmin/poweradmin |
Corregida | 4.2.7, 4.3.6, 4.4.2 | — | — |
4.2.74.3.64.4.2Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/poweradmin/poweradmin/security/advisories/GHSA-pcx2-9rwj-rj4rLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
