GHSA-7PJW-6V4G-F837
2FA-removal endpoint lacks brute-force lockout (residual gap, incomplete fix of CVE-2026-76213)
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-7PJW-6V4G-F837 divulgada · CVSS 6.5 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
CVE-2026-76213's fix (commit `59593a013`) added proper brute-force lockout
(`isTwoFactorLockedOut()` / `twoFactorFailure()`) to three login-flow 2FA verification entry
points:
- `Controller/Frontend/AuthenticationController.php` (`/check`)
- `Controller/Administration/AuthenticationController.php`
- `Controller/Frontend/Api/WebAuthnController.php`
A fourth endpoint that also calls `TwoFactor::validateToken()` —
`Controller/Frontend/Api/UserController.php::removeTwofactorConfig()`
(`POST /api/user/remove-twofactor`) — was not included in that hardening. It has no lockout at
all: an already-authenticated session can submit an unlimited number of guesses for the 2FA
code and permanently disable the account's 2FA once the correct one is found.
This endpoint's `validateToken()` call was itself only added later (commit `9d31dd73`, fixing
GHSA-h96g-59xp-7r5m's "no code verification at all"), which is why the July lockout hardening
never touched it — the code check this report is about didn't exist yet when that hardening
landed.
Affected / Environment
- Component: `Controller/Frontend/Api/UserController.php::removeTwofactorConfig()`,
- Affected versions: verified on `main`, HEAD `e623c505` (2026-09-20), i.e. post-dating
- Reproduced against a fresh install built from the project's own `docker-compose.yml`
Root cause
`removeTwofactorConfig()`:
if ((int) $this->currentUser->getUserData('twofactor_enabled') === 1) {
$code = trim(Filter::filterVar($data->code ?? null, FILTER_SANITIZE_SPECIAL_CHARS, ''));
if (!$twoFactor->validateToken($code, $this->currentUser->getUserId())) {
return $this->json(['error' => ...], Response::HTTP_FORBIDDEN);
}
// ... disables 2FA
}`validateToken()` (post the Sept-13 hardening) only rejects a code already accepted in the
same 30-second time slice (replay prevention) — it has no attempt counter and no lockout:
if (!$this->twoFactorAuth->verifyCode($secret, $token, self::VERIFY_DISCREPANCY)) {
return false;
}
$slice = intdiv(time(), self::PERIOD);
if ($slice <= $this->lastAcceptedSlice($userId)) {
return false;
}
return $this->rememberAcceptedSlice($userId, $slice);Neither this method nor its caller ever calls `isTwoFactorLockedOut()` / `twoFactorFailure()`,
the mechanism the three sibling endpoints use.
We also checked whether a generic layer covers this gap: `EventListener/ApiRateLimiterListener.php`
explicitly exempts any route whose name starts with `api.private.`, and
`removeTwofactorConfig()`'s route is named `api.private.user.remove-twofactor` — so it is
structurally excluded from the one rate limiter this codebase has.
Reproduction (fresh install, verified 2026-09-21)
- Installed phpMyFAQ from a clean clone via the real setup wizard
- Enabled real TOTP 2FA on the admin account (RFC 6238 secret), logged in with the correct
- Control group — reset the failure counter, then sent 7 consecutive wrong-code
```
attempt 1-6: Location: ./token?user-id=1 (login_attempts incrementing 1→6 in the DB)
attempt 7: Location: ./login (lockout fired — MAX_FAILED_LOGIN_ATTEMPTS=5 exceeded)
```
- Target — logged back in successfully (correct password + correct TOTP), fetched the
```
$ for i in 1..20: POST /api/user/remove-twofactor {"csrfToken":"<real>","code":"<random 6 digits>"}
→ every single one: HTTP 403 {"error":"You entered a wrong code!"}
```
No lockout, no throttling, no degradation across all 20 attempts — direct contrast with
the control group's 6-attempt lockout above.
- Rate-limiter liveness check — hammered a public API route
- Endgame — computed the real TOTP code for the current 30-second slice and submitted
```
$ POST /api/user/remove-twofactor {"csrfToken":"<real>","code":"<real TOTP>"}
→ HTTP 200 {"success":"The deletion of the current 2-factor configuration was successful."}
```
Confirmed via direct DB query that `faquserdata.twofactor_enabled` flipped `1 → 0`. A
subsequent password-only login (`POST /authenticate`) went straight to `Location: ./`
with no 2FA prompt at all — full, persistent 2FA downgrade, reproduced end-to-end on a
brand-new install, not inferred from code reading.
Impact
Threat model, stated explicitly: this is not an unauthenticated bypass. It requires
`isLoggedIn()` — an already-authenticated victim session — plus the `remove-twofactor` CSRF
token (obtainable by an attacker who already has that session, e.g. via XSS or a stolen
cookie). Given that precondition, it is a persistence / downgrade attack: an attacker with
a temporary foothold can permanently strip 2FA from the account with no rate limit on the
guess, converting a transient session compromise into a durable one that survives password
resets and outlasts the original session. The vendor's own commit history shows this class of
attack (brute-forcing a 2FA code) is already treated as worth guarding against — it was simply
missed on this one call site. This is also not an opt-in/insecure-configuration issue: 2FA is
a security feature the account owner turns *on*, and the gap reproduces on a fresh install
with default settings (rate limiter included).
Suggested patch
Reuse the existing `isTwoFactorLockedOut()` / `twoFactorFailure()` mechanism (already present
in `AuthenticationController.php` and `WebAuthnController.php`) in
`removeTwofactorConfig()`, keyed the same way (per-user or per-session, matching whatever the
sibling endpoints use) before calling `validateToken()`:
if ((int) $this->currentUser->getUserData('twofactor_enabled') === 1) {
+ if ($this->currentUser->isTwoFactorLockedOut()) {
+ return $this->json(['error' => Translation::get(key: 'msgTwofactorLockedOut')],
+ Response::HTTP_TOO_MANY_REQUESTS);
+ }
$code = trim(Filter::filterVar($data->code ?? null, FILTER_SANITIZE_SPECIAL_CHARS, ''));
if (!$twoFactor->validateToken($code, $this->currentUser->getUserId())) {
+ $this->currentUser->twoFactorFailure();
return $this->json(['error' => ...], Response::HTTP_FORBIDDEN);
}Related history
GHSA-h96g-59xp-7r5m removeTwofactorConfig() required no code verification at all
↓ fixed by (9d31dd73, Aug 15)
required a validateToken() call before disabling 2FA
CVE-2026-76213 login-flow 2FA verification had a session-scoped, easily-reset
brute-force counter
↓ fixed by (59593a013, Jul 31)
proper isTwoFactorLockedOut()/twoFactorFailure() lockout added to
3 login-flow entry points — predates 9d31dd73, so this 4th call
site didn't exist yet when the lockout logic was written
↓ this report
removeTwofactorConfig() still has zero lockout on validateToken()Disclosure
Happy to follow your coordinated-disclosure process (90-day default per your policy).
Credit: please use "baeseungwon1010" (github.com/baeseungwon1010).
AI Use Disclosure
AI (Claude) was used as a tool under my direction for code review, code summarization, and
script development. I reviewed and verified the AI-generated results before submission.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Packagistphpmyfaq/phpmyfaq |
Corregida | 4.2.0 | — | — |
4.2.0Arsenal 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-7pjw-6v4g-f837Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
