GHSA-4RPW-2M35-325X
Web user edit path allows privilege escalation to superuser via unguarded perm_templ assignment
CVSS:3.1/AV:N/AC:L/PR:L/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-4RPW-2M35-325X divulgada · CVSS 8.8 (GitHub) | |
| Divulgación | Modificada | Última actualización del registro | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
## Summary
Poweradmin's web user-management forms allow a delegated (non-superuser) user-administrator to escalate to full superuser (`user_is_ueberuser`, "god mode"). The edit path (`POST /users/{id}/edit`) accepts an attacker-chosen `perm_templ` value and write it to the database with NO content-aware guard. By submitting `perm_templ=1` (the seeded `Administrator` permission template, which is `template_type='user'` yet carries permission 53 `user_is_ueberuser`), the attacker promotes a controlled account — or creates a brand-new account with chosen credentials — to full superuser over the multi-tenant DNS install.
This is the SAME vulnerability class the maintainer fixed on the REST API path via GHSA-h4hf-v6w5-897x (`PermissionTemplateAssignmentGuard`), but that guard is applied ONLY to the API v1/v2 controllers. The web-UI single-edit path was never covered — an UNFIXED VARIANT on distinct code paths and sinks.
## Root Cause
The API fix's `PermissionTemplateAssignmentGuard::apply()` is invoked only in `lib/Application/Controller/Api/V1/UsersController.php:1035` and `Api/V2/UsersController.php:1034`. The web controllers (`EditUserController`, `AddUserController`) invoke no content-aware guard. The `templateGrantsUberuser`/`permissionTemplateAssignmentError` guard pair added post-v4.4.0 exists ONLY inside `UserManager::updateUserDetails` (the bulk path) — never in `editUser()` or `addNewUser()`.
Intermediate checks do not block promotion:
- `EditUserController::checkEditPermissions` (:263-269) only blocks editing an account that is ALREADY a superuser; it does not block PROMOTING a non-superuser.
- `DbPermissionTemplateRepository::validateTemplateType(1,'user')` (:189-200) checks only the `template_type` column, not template contents. Template id 1 is `template_type='user'` (sql/poweradmin-mysql-db-structure.sql:128) yet maps to perm 53 `user_is_ueberuser` (`perm_templ_items (1,1,53)` at :148-149; perm 53 = `user_is_ueberuser` at :102).
The sinks bind `:perm_templ` from caller input gated ONLY by `verifyPermission('user_edit_templ_perm')`:
- `UserManager::editUser()` (lib/Domain/Model/UserManager.php:550-552) — UPDATE.
## Impact
An authenticated non-superuser holding ordinary, grantable delegation permissions escalates to full superuser: complete read/write/delete over every zone and user in the multi-tenant install. HIGH — C:H/I:H/A:H.
## Proof of Concept
Promote a controlled non-superuser account, id 7):
POST /users/7/edit HTTP/1.1
Cookie: <delegated-admin session>
Content-Type: application/x-www-form-urlencoded
_token=<csrf>&username=puppet&email=p@x.tld&perm_templ=1&active=1&description=Attacker perms: `user_edit_templ_perm` + `user_edit_others`. Account 7 becomes `user_is_ueberuser`.
## Attack Chain
1. Entry: `POST /users/{id}/edit` (routes.yaml `/users/{id}/edit → EditUserController::run`) with `perm_templ=1`, target = controlled non-superuser. Guard: `checkEditPermissions` (:253-269). Bypass proof: block at :263-268 only fires for `isUserSuperuser($editId) && !currentIsSuperuser`; target is currently non-superuser → no block. Promotion is not covered.
2. Processing: `prepareUserData` (:282-312). Guard: self-pin (:302) and preserve branch. Bypass proof: `show_user_access_templates` defaults true → preserve branch skipped; caller holds `user_edit_others` → self-pin skipped → `perm_templ=1` taken from POST.
3. Guard: `validateTemplateType(1,'user')` (:309 → repo:189-200). Bypass proof: returns `template_type === 'user'`; id 1 IS type 'user' → passes despite granting perm 53.
4. Sink: `UserManager::editUser()` (UserManager.php:550-552) binds `:perm_templ=1` gated only by `verifyPermission('user_edit_templ_perm')`; no `templateGrantsUberuser` (grep of 450-563 = 0). Row UPDATE'd.
5. Impact: target holds `user_is_ueberuser` → god mode.
## Bypass Evidence
- `grep -rn "PermissionTemplateAssignmentGuard|templateGrantsUberuser"` → hits only in API v1/v2 UsersControllers, the guard class, unit tests, and `UserManager::updateUserDetails`. The web `EditUserController`/`AddUserController` and the `editUser`/`addNewUser` sinks: ZERO content-aware guard.
- `git show v4.4.0:lib/Domain/Model/UserManager.php | grep -c templateGrantsUberuser` = 0 (guard absent entirely on the latest release for these functions).
- `git log -S templateGrantsUberuser` → only commit `bbe9225e` (updateUserDetails, post-v4.4.0, unreleased). No commit ever added a content guard to `editUser` or `addNewUser` on any branch.
- Template id 1 = ueberuser: `sql/poweradmin-mysql-db-structure.sql:128` `(1,'Administrator',...,'user')`; `:148-149` `perm_templ_items (1,1,53)`; `:102` perm 53 = `user_is_ueberuser`.
- Note: `assignUserToGroups` re-checks ueberuser (:326), so GROUP escalation IS blocked — underscoring that the guard was applied inconsistently and the `perm_templ` path was missed.
## Affected Versions
`poweradmin/poweradmin <= 4.4.0` (vulnerable on the latest release tag v4.4.0 AND current HEAD 4ccd1ccf; no fix on any branch for these web sinks).
## Suggested Fix
Apply the same content-aware guard the API path uses (`PermissionTemplateAssignmentGuard` / `templateGrantsUberuser`) inside `UserManager::editUser()` and `UserManager::addNewUser()` (or at the `EditUserController`/`AddUserController` boundary): reject assigning any permission template that grants `user_is_ueberuser` unless the acting user is themselves a superuser. Validate template CONTENTS, not just `template_type`.
---
Reported by zx (Jace) — GitHub: @manus-use
Split note: this advisory originally also covered the create path (`POST /users/add`). That sink is fixed independently and is now tracked as GHSA-gqc9-4cxr-728j so each can get its own CVE ID.
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 | 3.9.12, 4.2.6, 4.3.5, 4.4.1 | — | — |
3.9.124.2.64.3.54.4.1Arsenal 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-4rpw-2m35-325xLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
