GHSA-8PR3-Q3CW-Q234
029 LDAP login silently reactivates blocked local accounts without logging the state change
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-8PR3-Q3CW-Q234 divulgada · CVSS 8.2 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
When LDAP authentication is enabled, `AuthLdap::create()` calls `User::setStatus('active')` unconditionally after a successful LDAP bind — even when the local phpMyFAQ account has been administratively blocked. This silently overwrites the `account_status` column from `blocked` to `active`, bypassing the admin's block. The state transition produces no log entry, so administrators have no way to detect that their security control was overridden.
Details
phpMyFAQ's LDAP login flow in `AuthLdap::checkCredentials()` calls `$this->create($login, ...)` after a successful LDAP bind. Inside `create()`, the code attempts to create a local user via `User::createUser()`. For pre-existing accounts (including blocked ones), `createUser()` calls `getUserByLogin()` — which populates `$this->userId` and `$this->status` via `extractUserFromResult()` — and then throws an exception because the login already exists. The exception is silently caught and logged at `info` level. After the catch, `setStatus('active')` runs unconditionally, issuing `UPDATE faquser SET account_status = 'active' WHERE user_id = <blocked_user_id>`.
`AuthLdap::checkCredentials()` — calls `create()` after LDAP bind, discards its return value (`phpmyfaq/src/phpMyFAQ/Auth/AuthLdap.php`):
if (!$this->ldapCore->bind($bindLogin, htmlspecialchars_decode($password))) {
throw new AuthException($this->ldapCore->error ?? 'LDAP bind failed.');
}
// ... AD group membership restriction checks ...
$this->create($login, htmlspecialchars_decode($password));
return true;`AuthLdap::create()` — catches the duplicate-user exception, then unconditionally sets status to active (`phpmyfaq/src/phpMyFAQ/Auth/AuthLdap.php`):
$result = false;
$user = $this->createUser();
try {
$result = $user->createUser($login, '', $domain);
} catch (\Exception $exception) {
$this->configuration->getLogger()->info($exception->getMessage());
}
$this->connect($this->activeServer);
$user->setStatus('active'); // ← unconditional
$user->setAuthSource(AuthenticationSourceType::AUTH_LDAP->value);`User::createUser()` — `getUserByLogin()` populates `$this->userId` before throwing (`phpmyfaq/src/phpMyFAQ/User.php`):
if ($this->getUserByLogin($login, false)) { // side-effect: sets $this->userId
throw new Exception(self::ERROR_USER_LOGIN_NOT_UNIQUE);
}`User::getUserByLogin()` — calls `extractUserFromResult()` which sets `userId`, `status`, etc. (`phpmyfaq/src/phpMyFAQ/User.php`):
$this->extractUserFromResult($result); // sets $this->userId = blocked user's ID
$this->userData()->load($this->getUserId());
return true;`User::setStatus()` — issues an UPDATE against the now-populated `userId` (`phpmyfaq/src/phpMyFAQ/User.php`):
$update = sprintf(
"UPDATE %sfaquser SET account_status = '%s' WHERE user_id = %d",
Database::getTablePrefix(),
$this->configuration->getDb()->escape($status),
$this->userId, // ← points to the blocked user's row
);The full chain: `getUserByLogin()` sets `$user->userId` to the blocked user's database ID → `createUser()` throws → the exception is silently caught → `setStatus('active')` overwrites the blocked row → `checkCredentials()` returns `true` → login succeeds.
The `setStatus('active')` call produces no log entry. The only related log message is the `info`-level exception `"The Login name already exists."`, which mentions nothing about an account status change. Administrators reviewing logs have no indication that a blocked account was reactivated.
Suggested fix — add a guard and a log entry in `create()` before `setStatus('active')`:
$this->connect($this->activeServer);
+ if (!$result && ($user->getStatus() === 'blocked' || $user->getStatus() === 'protected')) {
+ $this->configuration->getLogger()->warning(
+ sprintf('LDAP login attempt for %s account "%s" denied.', $user->getStatus(), $login)
+ );
+ throw new AuthException(
+ sprintf('Local account "%s" is %s and cannot be activated via LDAP.', $login, $user->getStatus())
+ );
+ }
+
$user->setStatus('active');
$user->setAuthSource(AuthenticationSourceType::AUTH_LDAP->value);PoC
Prerequisites:
- A phpMyFAQ instance (any supported version) with LDAP authentication enabled and Composer dependencies installed.
- A local phpMyFAQ user account that has been set to `blocked` by an administrator, whose login matches a valid LDAP account.
Step 1: Install dependencies.
cd /path/to/phpMyFAQ-repo
composer install --working-dir=phpmyfaq --no-devStep 2: Run the exploit against the vulnerable source.
REPO_ROOT=$(pwd) php poc_029/exploit.phpThe exploit calls the real `AuthLdap::create()` method from the project source, backed by a live SQLite database created via phpMyFAQ's own `Installer` class. A stub `LdapCore` is injected via Reflection to avoid requiring a real LDAP server — no vulnerable logic is reimplemented.
Expected output (vulnerable version):
=== phpMyFAQ LDAP Account Unblock — AuthLdap::create() PoC ===
Repo under test: /path/to/phpMyFAQ-repo
Inserted user 'victim_user' (ID=99) with status: blocked
Calling AuthLdap::create('victim_user', 'anypassword') ...
(simulates the call made after a successful LDAP bind in checkCredentials)
Status before AuthLdap::create(): blocked
Status after AuthLdap::create(): active
[VULNERABLE] AuthLdap::create() unblocked 'victim_user': blocked → activeExit code `2` = vulnerable, `0` = safe (fix applied), `1` = environment error.
Step 3: Apply the fix and re-run.
git apply poc_029/fix.patch
REPO_ROOT=$(pwd) php poc_029/exploit.phpExpected output (fixed version):
Status before AuthLdap::create(): blocked
Status after AuthLdap::create(): blocked
[SAFE] 'victim_user' remains 'blocked' after AuthLdap::create() — fix is effective.
AuthException was thrown: Local account "victim_user" is blocked and cannot be activated via LDAP.Impact
The `account_status` field is the primary mechanism administrators use to revoke access for individual users. Because `AuthLdap::create()` unconditionally overwrites this field to `active`, any user whose local account was blocked but whose LDAP credentials remain valid can bypass the block by simply logging in. The reactivation persists in the database and is not logged as a security event, so the bypass can go undetected indefinitely.
- Who is impacted: Any phpMyFAQ deployment that uses LDAP authentication and relies on local account blocking to revoke user access.
- What an attacker can do: Regain full access to an account that was explicitly blocked by an administrator, without any admin re-approval or notification.
- Authorization bypass (CWE-863): The unconditional `setStatus('active')` overrides an admin-imposed block without checking the current account status.
- Insufficient logging (CWE-778): The security-critical state transition (`blocked` → `active`) produces no log entry, making the bypass undetectable to administrators. This falls under OWASP A09 (Security Logging and Alerting Failures).
Affected versions
>= 3.1.0, <= 4.1.6 (latest stable release; no fix exists in any released version)
The unconditional `setStatus('active')` call was introduced in commit `baa3a39ce` ("refactor: renamed methods for Auth classes and cleanup"), first released in version `3.1.0`. The vulnerable pattern remains in every subsequent release through `4.1.6`, which is the latest stable release at time of writing. The current development HEAD (`main` branch, commit `122700921`) is also affected. Per `SECURITY.md`, versions 4.1.x and 4.2.x are supported for security fixes; versions < 4.1 are end of life.
Pavel Kohout
Aisle Research
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Estado del parche por paquete
La fuente no informa paquetes ni versiones corregidas.
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/thorsten/phpMyFAQ/security/advisories/GHSA-8pr3-q3cw-q234Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
