GHSA-7CHR-FVFR-CP98
Domain admin can take over SuperAdmin / Reseller accounts that have a mailbox in their domain
Texto original en inglés · Ver en español
CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Remediación | Parche 2.11.1 | modoboa · -24 d desde divulgación | |
| Divulgación | Publicada | GHSA-7CHR-FVFR-CP98 divulgada · CVSS 7.7 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
When such an account is created through the REST API (v1 and v2), the mailbox is created before the account's role is set. Mailbox.post_create() is supposed to skip privileged accounts when it grants access to the domain's administrators. Because the role isn't set yet at that point, the check always passes, so every administrator of that domain gets access to the account. Promoting an existing user with a mailbox to SuperAdmin or Reseller has the same result, because the role setter never removes the access already granted.
The account endpoints only check that access. They never compare the target's role with the caller's. With it, a domain administrator can reset the privileged account's password without knowing the current one, log in as SuperAdmin, and take full control of the instance. They can also demote, disable or delete that account.
The only precondition is that a privileged account has a mailbox in the attacker's domain. That is common, since operators often keep their own address in a hosted domain.
Details
Where:
- modoboa/admin/api/v2/serializers.py:725-726 and
modoboa/admin/api/v1/serializers.py:482-483: when an account is
created, the mailbox is created before the role is set.
- modoboa/admin/models/mailbox.py:287-301 (Mailbox.post_create): the
check "not self.user.has_perm('admin.add_domain')" is meant to skip
privileged accounts, but at that moment the account has no role yet,
so every domain admin of the mailbox's domain is granted access to the
mailbox and to the account.
- modoboa/core/models.py:283-317 (User.role setter): promoting an
existing account to SuperAdmins (or Resellers) never removes access
that domain admins already hold on it.
- PATCH /api/v2/accounts/<id>/ then lets that domain admin change the
account's password; there is no check that the target's role is not
higher than the caller's, and no old password is needed.
- The sibling path does it right: Domain.add_admin
(modoboa/admin/models/domain.py:267-271) skips mailboxes whose owner
has admin.add_domain.
Proof of concept
Test (Django test client, a DomainAdmin of example.test; a SuperAdmin
creates the other accounts):
- SuperAdmin created with a mailbox in example.test: DomainAdmin GET
200, PATCH password 200, password changed, and login as that
SuperAdmin with the new password works.
- Reseller created with a mailbox in example.test: GET 200, PATCH 200,
password changed.
- Existing simple user in example.test promoted to SuperAdmins: GET
200, PATCH 200, password changed.
Controls:
- SuperAdmin without a mailbox: GET 404, PATCH 404, unchanged.
- SuperAdmin with a mailbox in another domain: GET 404, PATCH 404, unchanged.
- Domain admin assigned to example.test after the SuperAdmin existed
(Domain.add_admin path): GET 404, PATCH 404, unchanged.
Impact
any domain admin of a domain where a SuperAdmin or Reseller
has a mailbox (common: the operator's own address is in a hosted
domain) can reset that account's password and log in as SuperAdmin,
i.e. full control of the server's mail configuration and all domains.
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 |
|---|---|---|---|---|
pypimodoboa |
Corregida | 2.11.1 | -24 d | 2.13.0 no afectada |
2.11.1Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/modoboa/modoboa/security/advisories/GHSA-7chr-fvfr-cp98Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
