GHSA-2GVC-2VR9-4F5H
Application State Type Corruption Leading To Persistent Authentication Denial-of-Service via Unvalidated Type Assumption in isBlockedAttempt() (v0.28.6.0)
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-2GVC-2VR9-4F5H divulgada · CVSS 7.5 (GitHub) | |
| Divulgación | Modificada | Última actualización del registro | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
## Summary
This advisory documents a logic flaw present in version 0.28.6.0 of the codebase, which appears to have since been mitigated in the current up-to-date version. The login lockout logic in `isBlockedAttempt()` retrieves a "locked" record from the database and assumes the result will always be an object, without validating its structure before accessing a property on it. When the retrieved value is not an object, PHP raises a fatal error (`Attempt to read property "counter" on array`), which persistently blocks all subsequent login attempts for the affected account until the underlying database row is corrected.
### Affected file (v0.28.6.0):
https://github.com/ci4-cms-erp/ci4ms/blob/0.28.6.0/modules/Auth/Libraries/AuthLibrary.php
This advisory supersedes the earlier report (GHSA-953h-3w68-vh3g), which was closed as invalid on the basis that the reproduction was shown in a development environment. This report clarifies exactly what is and isn't confirmed, and requests the maintainer's help resolving the one open question I could not verify myself.
## Description
The vulnerable pattern in `isBlockedAttempt()`:
$countLocked = $this->userModel->getOneOr('locked', $where, 'id DESC', 'id,counter,expiry_date', $where_or);
if (!$countLocked) $countLockedValue = 0;
else $countLockedValue = $countLocked->counter;This only guards against a falsy return. It does not verify that a truthy return value is actually an object before accessing `$countLocked->counter`. If `getOneOr()` ever returns a non-empty array instead of an object for a matched row, this throws an unhandled fatal error, halting the authentication flow before login can succeed or fail normally.
### What This Report Clarifies
The prior closure reasoning was that the demonstrated crash occurred with `CI_ENVIRONMENT=development`, and that this "does not come with a security impact." I want to be transparent: I have attempted multiple times to stand up a production-configured instance to test this myself, and was unable to resolve the environment issues that came up on my end.
To be precise about what is and isn't in question:
- Not in question: the code pattern above existed in v0.28.6.0 and lacked a type/structure check before property access — a property of the code itself, independent of environment configuration.
- In question: whether CodeIgniter's production environment setting changes only error *display* (suppressing the debug page), or also changes whether the underlying fatal error is caught/handled elsewhere versus still terminating the request.
### Request
Since I couldn't resolve a production test environment myself, I'd appreciate help confirming: does this code path throw an unhandled fatal error (even if only visible in logs, not displayed to the user) when triggered with `CI_ENVIRONMENT=production`? If so, this represents a real Availability impact in production regardless of whether a detailed error page is shown to the end user.
## Steps to Reproduce (development, previously confirmed)
1. Open the login page.
2. Submit the following in the login form fields:
- email: '@gmail.com
- password: test"><img src=1 onerror=alert()>
3. Observe: `ErrorException: Attempt to read property "counter" on array` at `AuthLibrary.php:428`.
4. Subsequent login attempts with valid credentials continue to fail until the affected database row is corrected.
Suggested Fix
if (is_array($countLocked)) {
$countLockedValue = $countLocked['counter'] ?? 0;
} elseif (is_object($countLocked)) {
$countLockedValue = $countLocked->counter ?? 0;
} else {
$countLockedValue = 0;
}Standardizing `getOneOr()` to consistently return one type would address the root cause rather than just this specific call site.
## Ready Video POC
`https://mega.nz/file/7EtWAZab#asOdGxYRp2Z5HWyIVLBqQqpnUIwVvvVhRczvzouRWL0`
## Additional Context
I'm currently working with the CWE (Common Weakness Enumeration) team on formalizing this general pattern — an application persisting structurally-invalid data and later trusting it without revalidation — as a new weakness class. The submission is already accepted by the CWE team and is in the detailed-submission phase for publication. This case is one of several real-world examples supporting that submission. I'd be grateful for any help confirming the production question above, and for consideration of a CVE for this finding, even if ultimately scoped to development-mode impact — production confirmation would strengthen it further, but either way it would be valuable supporting evidence for the CWE entry.
Full CWE submission thread, if useful for context:
`https://github.com/CWE-CAPEC/CWE-Content-Development-Repository/issues/181`
### Update
Finally could resolve production issues and hosted in production environment, result was that the issue is reproducible in production.
### Updated POC
`https://streamable.com/4ki7lb`
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 |
|---|---|---|---|---|
Packagistci4-cms-erp/ci4ms |
Sin parche | — | — | — |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/ci4-cms-erp/ci4ms/security/advisories/GHSA-2gvc-2vr9-4f5hLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
