GHSA-2VF9-2QW7-8HMR
Key generation lets any session holder replace their own account password without the current one, and returns the new password
CVSS:3.1/AV:N/AC:H/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-2VF9-2QW7-8HMR divulgada · CVSS 6.8 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
The key generation endpoint lets any session holder replace their own account's password without knowing the current password, and returns the new password in clear text. Whoever holds a user's web session (a stolen cookie, an unattended browser) can therefore turn it into a valid password for the account. That locks the owner out and keeps the access after the session ends.
Details
Paths under `app/sources/`, line numbers as of 3.2.4.0.
`keyHandler()` handles `user_new_keys_generation` (`main.queries.php:869-911`):
- The action is open to every user (`$all_users_can_access`, lines 738-742).
- When the request carries no `user_id`, the target defaults to the caller's own account (line 751), and the authorization block for other accounts (753-793) is skipped.
- The current password is verified only when the client-supplied flag `generate_user_new_password` is not the boolean `true` (line 875).
With the flag set, `handleUserKeys()` (`main.functions.php:9297-9575`) does the following:
- generates a random password (9357-9360);
- writes its hash and a new key pair to the account (9423-9443);
- puts the new private key into the caller's session (9500-9506);
- queues the background re-key, which re-encrypts the account's item keys under the new key pair;
- returns the new password to the caller as `user_password` (9561-9568).
When `send_email_to_user` is false, the owner is not notified. Only the administrator dialogs send the flag, for another user's account. The server never enforced that.
The profile path `change_pw` (`changePassword()`, `main.queries.php:1314-1461`) does not verify the current password either. On a standard schema it fails before writing anything (it updates `users.fonction_id`, a column dropped in 3.1.5), so it is not exploitable there. It is fixed in the same release.
History:
- 3.1.2 started returning the generated password. In 3.1.2 the endpoint also accepted any `user_id` from any user.
- 3.1.3 restricted other accounts to administrators and managers, which left the caller's own account open.
Proof of concept
The attacker holds user U's session cookie. The decoded response of step 2 holds a new password for U's account.
- Load any page with U's cookie and read the session key (the `key` value embedded in the page).
- `POST sources/main.queries.php` with:
- `type=user_new_keys_generation`
- `type_category=action_key`
- `key=<session key>`
- `data` = `{"generate_user_new_password":true,"user_pwd":"","encryption_key":"","delete_existing_keys":false,"send_email_to_user":false,"encrypt_with_user_pwd":true,"email_body":"","user_self_change":false,"recovery_public_key":"","recovery_private_key":""}`, encrypted with the session key when client-server encryption is enabled. No `user_id`.
- Once the background re-key has finished, the new password signs in to U's account. U's own password no longer does.
Impact
The attacker must already hold a live session of the user. In return, they:
- gain the account password and keep access to the vault after that session ends;
- lock the owner out of a locally authenticated account.
Two-factor authentication, when enabled on the account, still has to be passed at sign-in. For LDAP and OAuth2 accounts the generated password is not the one used to sign in, but the account's keys are still replaced. This also defeats the owner's recovery: per GHSA-p84q-3h9h-qvh6, a recovery does not end the attacker's session, so the attacker can run the request again.
Patches
Fixed in 3.2.4.1:
- A password is generated only for another account, by a user authorized to manage it.
- A key generation on the caller's own account always verifies the current password.
- `change_pw` verifies the current password before any write.
Workarounds
None short of upgrading. Enabling two-factor authentication keeps the generated password from signing in, but the owner is still locked out.
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 |
|---|---|---|---|---|
Packagistnilsteampassnet/teampass |
Corregida | 3.2.4.1 | — | — |
3.2.4.1Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/nilsteampassnet/TeamPass/security/advisories/GHSA-2vf9-2qw7-8hmrLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
