GHSA-7FW5-QPHW-GH3V
Non-constant-time comparison of API key in DbApiKeyRepository (CWE-208)
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-7FW5-QPHW-GH3V divulgada · CVSS 3.7 (GitHub) | |
| Divulgación | Modificada | Última actualización del registro | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
### Summary
Poweradmin compares the presented API key against stored keys using PHP's native `===` operator instead of the constant-time `hash_equals()`, creating a timing side-channel (CWE-208) in API key authentication.
### Details
File: lib/Infrastructure/Repository/DbApiKeyRepository.php:136
if ($row['secret_key'] === $secretKey) {
Every stored API key (64 hex chars / 256 bits of entropy, generated via bin2hex(random_bytes(32))) is compared against the presented key in a loop over the full api_keys table.
### PoC
Environment: Poweradmin (main branch), PHP 8.4.24, SQLite backend, php -S localhost:8000.
1. Create an admin user and generate a real API key through the web UI.
2. Send authenticated requests to /api/v2/zones via curl using a valid key, and separately using an invalid key with a correct prefix vs. an invalid key with an incorrect prefix.
3. A local microbenchmark (~20,000 trials) of === vs hash_equals() showed a small (~5ns), repeatable timing difference between early- and late-position mismatches for ===, consistent with short-circuit behavior; hash_equals() showed flat timing. This was measured locally, not over this network call.
No PoC for practical remote timing extraction is provided, as the mitigating factors below make it impractical.
### Impact
The key is 256 bits of cryptographically random data, and network jitter is orders of magnitude larger than the measured local signal (~5ns), so practical exploitation is very unlikely. No rate limiting was found on the API-key authentication path specifically, but this does not materially change the conclusion given the key length. Reported as a defense-in-depth issue.
### Suggested fix
if (hash_equals($row['secret_key'], $secretKey)) { ... }
Split note: this advisory originally also covered the password reset token and email MFA code comparisons. Those are independent fixes and are now tracked as GHSA-pqq8-jq6g-3fhj (reset token) and GHSA-h999-wxwv-x8p8 (MFA code) so each can get its own CVE ID.
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 |
|---|---|---|---|---|
Packagistpoweradmin/poweradmin |
Corregida | 4.2.6, 4.3.5, 4.4.1 | — | — |
4.2.64.3.54.4.1Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/poweradmin/poweradmin/security/advisories/GHSA-7fw5-qphw-gh3vLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
