llamaCVEVulnerability Intelligence
/
Advisory · GitHub · Packagist · phpmyfaq/phpmyfaq

GHSA-F98M-HCJV-7RP9

Admin 2FA brute-force throttle is session-scoped, so a fresh cookie jar resets the counter and TOTP codes can be guessed at will

Sin parche publicado
Descargar PNG JSON
CVSS 3.1
7.4
Alta
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición108 dDesde la divulgación, 4 ago 2026, 1:06 p. m.
Detección108 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
4 ago 26
20 nov 26
21 nov 26
4 ago 26
31 ago 26
27 sept 26
24 oct 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-F98M-HCJV-7RP9 divulgada · CVSS 7.4 (GitHub)
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés
Summary

Admin 2FA brute-force throttle is session-scoped, so a fresh cookie jar resets the counter and TOTP codes can be guessed at will

Affected versions and vulnerable location

  • Confirmed on default branch `main` at `5d4a975cdc53dca26383f2b8a56596b1272fcac2` (tag `4.1-nightly-2026-07-30`).
  • Present in the current 4.1.x line.
  • Vulnerable flow:
  • `phpmyfaq/src/phpMyFAQ/Controller/Frontend/AuthenticationController.php:169` route `POST /authenticate`
  • `phpmyfaq/src/phpMyFAQ/Controller/Frontend/AuthenticationController.php:208` (`2fa_failed_attempts` reset to 0 on every successful password auth)
  • `phpmyfaq/src/phpMyFAQ/Controller/Frontend/AuthenticationController.php:264` route `POST /check`
  • `phpmyfaq/src/phpMyFAQ/Controller/Frontend/AuthenticationController.php:286` (throttle: only a session counter, capped at 5)
  • `phpmyfaq/src/phpMyFAQ/Controller/Frontend/AuthenticationController.php:305` (per-failure increment)
  • `phpmyfaq/src/phpMyFAQ/User/UserAuthentication.php:87` (`authenticate()`: records only FAILED logins to the rate limiter)
  • `phpmyfaq/src/phpMyFAQ/User/TwoFactor.php:89` (`validateToken` -> RobThree `verifyCode` with default discrepancy)

Attacker model

A remote attacker who already holds the victim's password and is attempting to defeat the second factor. This is the exact scenario 2FA exists to defend against (leaked/reused/phished password). No prior session or privilege on the target account is required beyond the password.

Why the throttle does not throttle

The second-factor step is a two-request state machine tied to the session:

  1. `POST /authenticate` validates the password. When 2FA is enabled it does not log the user in; it stores `2fa_pending_user_id` in the session and sets `2fa_failed_attempts` to `0` (line 207-208), then redirects to the token page.
  2. `POST /check` reads the submitted token, confirms `2fa_pending_user_id` matches the posted `user-id` (line 280-283), and rejects once `2fa_failed_attempts >= 5` (line 286-289). Each wrong token increments that session counter (line 305).

Two independent facts make the cap ineffective:

  • The counter lives only in the session. It is not keyed to the account or the client IP. A fresh session (new cookie jar) starts the counter at its `0` default, and the persistent per-IP budget in `UserAuthentication` counts only failed *password* logins, never 2FA guesses (see below).
  • Even within one session, `POST /authenticate` with the correct password resets `2fa_failed_attempts` back to `0` (line 208). Reaching the cap in `check()` also removes `2fa_pending_user_id` (line 287), so the attacker re-posts the correct password to restore the pending state, and that same request zeroes the counter again.

The per-IP defense in `UserAuthentication::authenticate()` does not help here:

  • `hasExhaustedFailedLoginBudget()` (`UserAuthentication.php:145`) uses `peek()` (non-consuming) against `MAX_FAILED_LOGINS_PER_IP = 15` over `FAILED_LOGIN_WINDOW = 300` (`UserAuthentication.php:43,48`).
  • The budget is only consumed by `recordFailedLogin()` (`UserAuthentication.php:156`), which runs solely on a *failed* password login (lines 104/132/135). A correct password returns before any record and, when 2FA is enabled, returns at `UserAuthentication.php:111-114` with `setLoggedIn(false)`.

So the attacker's repeated correct-password re-auths never touch the failed-login budget. There is no per-account lockout on the 2FA step and no persistent rate limit on token submissions. `TwoFactor::validateToken` also keeps no record of previously tried or previously accepted codes, so there is no replay/one-time-use guard.

Reachability trace verified on default branch

  1. `POST /authenticate` (public route) with the known password -> `2fa_pending_user_id` set, `2fa_failed_attempts = 0`, no rate-limit consumed.
  2. `POST /check` with `user-id` = victim id and a guessed 6-digit `token`. Up to 5 guesses accepted per session state before the pending id is cleared.
  3. Loop step 1 to restore pending state and reset the counter. Repeat.
  4. `validateToken` calls RobThree `verifyCode($secret, $token)` with no discrepancy argument, so the library default acceptance window applies (the current code plus one step either side, i.e. three valid codes per 30-second period). Nothing marks a code as consumed.

The guessing is unbounded in rate from the application's side. Across enough TOTP windows a six-digit code (10^6 space, three accepted per window) is recoverable by sustained automated guessing, which is precisely the condition CWE-307 covers.

Reproduction

Source-verified. No runtime exploit was executed in this pass (no live instance stood up). The claim rests on the control-flow trace above, verified by reading the code at HEAD.

Commands run from the clone:

rg -n "2fa_failed_attempts|2fa_pending_user_id|Route\(path: '/authenticate'|Route\(path: '/check'" \
  phpmyfaq/src/phpMyFAQ/Controller/Frontend/AuthenticationController.php
rg -n "recordFailedLogin|hasExhaustedFailedLoginBudget|MAX_FAILED_LOGINS_PER_IP|peek\(" \
  phpmyfaq/src/phpMyFAQ/User/UserAuthentication.php
rg -n "verifyCode|validateToken|discrepancy" phpmyfaq/src/phpMyFAQ/User/TwoFactor.php

Observed:

AuthenticationController.php:207:  $this->session->set('2fa_pending_user_id', $this->currentUser->getUserId());
AuthenticationController.php:208:  $this->session->set('2fa_failed_attempts', 0);
AuthenticationController.php:286:  if ((int) $this->session->get('2fa_failed_attempts', 0) >= 5) {
AuthenticationController.php:305:  $this->session->set('2fa_failed_attempts', (int) $this->session->get('2fa_failed_attempts', 0) + 1);
UserAuthentication.php:104:  $this->recordFailedLogin();   // only on failed password
UserAuthentication.php:163:  $this->rateLimiter?->check($failedLoginKey, self::MAX_FAILED_LOGINS_PER_IP, self::FAILED_LOGIN_WINDOW);
TwoFactor.php:103:  return $this->twoFactorAuth->verifyCode($secret, $token);

Suggested fix

  1. Throttle the 2FA step persistently, keyed to the account (and ideally the client IP), not the session. Reuse the existing `RateLimiter` used for password logins so that token submissions consume a per-account/per-IP budget that survives new sessions and re-auth.
  2. Do not reset the failure count on a successful password re-auth. Track 2FA failures against the pending user id and enforce a lockout window once exceeded.
  3. Enforce one-time use of a given TOTP within its window (store the last accepted timestamp/counter) so a code cannot be replayed, and keep the RobThree discrepancy at the minimum the deployment tolerates.

Severity and CVSS reasoning

Suggested severity: High.

Suggested CVSS:3.1 vector: `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N` (7.4).

  • `AV:N`: public network routes.
  • `AC:H`: the attacker must already hold the password and must sustain guessing across TOTP windows; success is probabilistic rather than immediate.
  • `PR:N`: no privilege on the target account beyond the password.
  • `C:H/I:H`: a successful bypass yields a full authenticated session for the victim account.
  • `A:N`: no direct availability impact.

Context: this is a sibling of the maintainer's published GHSA-9pq7-mfwh-xx2j ("Unauthenticated 2FA brute-force via /admin/check accepting arbitrary user-id"). That earlier hole let any user id be targeted without a password; the current `/check` flow correctly binds the pending user to a validated password, but the throttle added to replace the old behaviour is session-scoped and reset-on-reauth, leaving the same brute-force outcome for an attacker who has the password.

How I found it and a note on tooling

I traced the two-request 2FA state machine from the public routes to the token verifier, then checked every place a limit could be enforced: the session counter in `check()`, the per-IP budget in `UserAuthentication`, and the token verifier itself. The finding is that none of them bind a durable limit to the account or IP for 2FA submissions, and the one counter present is reset by a free correct-password re-auth. I used AI assistance for navigation and drafting and manually verified the cited call chain and line numbers against HEAD before finalizing. Verification is source-only; I did not execute a runtime brute-force against a live instance.

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:N
RedAdyacenteLocalFísica
ComplejidadAC:H
BajaAlta
PrivilegiosPR:N
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:H
AltoBajoNinguno
IntegridadI:H
AltoBajoNinguno
DisponibilidadA:N
AltoBajoNinguno
Versiones

Rangos afectados

Afectada Corregida
phpmyfaq/phpmyfaq≤ 4.1.6
4.1.6
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
Packagistphpmyfaq/phpmyfaq
Sin parche — — —
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/thorsten/phpMyFAQ/security/advisories/GHSA-f98m-hcjv-7rp9

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.