GHSA-XP38-WCCV-8V49
Change proposals overwrite the encryption keys of an unrelated item, making its password unrecoverable
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-XP38-WCCV-8V49 divulgada · CVSS 8.1 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
The `suggest_item_change` action of `sources/items.queries.php` stored a change proposal, then wrote that proposal's encryption key into the item key table under the proposal's own row id. Proposal ids and item ids are two independent sequences, so each proposal replaced every user's key on the unrelated item that happened to carry the same id. That item's password can no longer be decrypted by anyone, including the server's recovery account. Any signed-in user could trigger it repeatedly and destroy the passwords of items in every folder, personal folders included.
Details
`suggest_item_change` inserted a row into the `items_change` table, then called:
storeUsersShareKey('sharekeys_items', 0, $newID, $cryptedStuff['objectKey']);`$newID` is the id of the new `items_change` row. In `sharekeys_items`, `object_id` is an `items` id, and the pair `(object_id, user_id)` is unique. The call therefore took the public-object path of `storeUsersShareKey()` for the item whose id equals `$newID`:
- It upserted a key for every active user, the TeamPass recovery account included, replacing the item's real keys.
- Its clean-up pass deleted the keys of the remaining users, such as the API account.
- When no password was proposed, the object key was empty and `encryptUserObjectKey()` returned an empty string, so the keys were blanked rather than replaced.
Either way, the item's object key, which exists only inside those keys, was lost. The item's password, still encrypted in `items.pw`, can no longer be decrypted. Older releases, 3.0.0.0 among them, first deleted all of the item's keys and then inserted the new ones, with the same result.
Each call advances the `items_change` sequence by one, so repeated calls reach item 1, 2, 3 and so on, whatever folder holds them. The target is set by the sequence, not by the item id posted in the request.
Access to the action:
- From 3.0.0.0 to 3.1.x, the action had no access check. Any signed-in user could call it.
- From 3.2.0.0, it required the posted item to be in a folder the caller can open. Any user with at least one folder or a personal folder meets that requirement. Read-only accounts were not refused, and the `enable_suggestion` setting was not checked.
- Until 3.1.1, the Items page offered the proposal form when `enable_suggestion` was enabled. Ordinary proposals made through that form also destroyed an unrelated item's keys, without any malicious intent. The form was removed in 3.1.2, and the action stayed reachable through a crafted request.
The proposed password was never read back anywhere: the proposals were only counted.
Proof of concept
- Sign in as any user who can open a folder holding at least one item.
- Post `type=suggest_item_change` to `sources/items.queries.php` with the session key and an encrypted payload holding the id of that item. Every other field can be empty.
- Read the new `items_change` id (`N`). Every user's key on the item with id `N` has been replaced by an empty string, and that item's password no longer opens for anyone.
- Repeat to reach `N+1`, `N+2` and so on.
Impact
- Permanent loss of stored passwords, in shared and personal folders, for every item an attacker reaches. Repairing the keys cannot bring them back, because the object key no longer exists anywhere. The only recovery is a database backup taken before the damage.
- No confidentiality impact: the caller receives no key or password of the target item.
Patches
3.2.4.5 removes the `suggest_item_change` action and the unused form code that called it. No page used it any more, and the proposed values were never read. Existing `items_change` rows are left in place.
Workarounds
None short of upgrading. The `enable_suggestion` setting was not checked by the action, so turning it off does not help.
Detecting earlier damage
Each proposal damaged the item whose id equals the proposal's id. On an installation that ever received proposals:
- `SELECT id FROM <prefix>items_change` lists the ids of the items that were hit, for the proposals still stored. The default prefix is `teampass_`.
- Purging an item also deletes its proposals, so the table can be incomplete. Its `AUTO_INCREMENT` value minus one gives the highest item id that may have been hit.
- For each of those ids, check that the item's password still opens for its users. If it does not, restore it from a backup or have it re-entered.
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.5 | — | — |
3.2.4.5Arsenal 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-xp38-wccv-8v49Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
