GHSA-R6R4-5MR3-RPPM
Read-only user can delete attachments in readable folders
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-R6R4-5MR3-RPPM divulgada · CVSS 8.1 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
TeamPass did not check the right a user holds on an item before changing its attachments:
- A user who can only read a shared folder can permanently delete the attachments of its items.
- Any user able to create an item can **move the attachments of any other item onto their own and
- A user can also get a file of their choice published as an attachment of an item they cannot edit.
Details
Attachments are written to the `files` table as soon as they are uploaded, unconfirmed, under the
item they target. They are attached once the item is saved. Three server-side handlers trusted the
request:
- Deleting an attachment
- `delete_attached_file` (`app/sources/items.queries.php`) only checked that the item's folder
- That list holds every folder the user can see:
- read-only folders;
- folders without the edit right (`NE`, `NDNE`);
- for an administrator, every shared folder.
- Read-only accounts and item restrictions (`restricted_to`, role restrictions) were not checked
- The handler deletes the database row, the sharekeys and the encrypted file on disk.
- Attaching files to a new item
- The attachments of an item being created are uploaded first, under a temporary id generated by
- On save, `new_item` moved to the new item every `files` row whose item id equalled that value,
- Sending the id of an existing item as the temporary id therefore moved all of that item's
- Attachment keys of items outside personal folders are shared with every user, whatever their
- Uploading an attachment
- `upload.attachments.php` only checked the edit right when the upload declared an existing item
- `confirm_attachments` then confirmed every unconfirmed file of the item the next time an editor
- Opening an item discards its unconfirmed files, so the file has to be uploaded while an editor
- Before 3.2.0.0, the upload checked no right at all.
Proof of concept
The session key is the one the items page embeds in its own scripts. Requests go to
`sources/items.queries.php`, with `data` encrypted by the page's `prepareExchangedData()`.
Deletion.
1. An administrator gives user B read-only access to a shared folder holding an item with an
attachment.
2. B opens the item and reads the attachment id returned by `show_details_item`. File ids are
sequential, so they can also be enumerated.
3. B posts `type=delete_attached_file` with `{"file_id": <id>}`.
4. The attachment is gone for everyone.
Read.
1. User C has no access to the folder of item V, which holds attachments. C has a personal folder.
2. C creates an item in their personal folder, and sets `uploaded_file_id` to the id of V in the
`new_item` request. Item ids are sequential, and the id of C's previous item gives the current
upper bound.
3. V's attachments are now listed on C's new item. C downloads them in clear, and V no longer has
them.
Impact
- Deletion. Who can do it: any user with read-only, `NE` or `NDNE` access to a folder, a
- Read. Who can do it: any user who is not read-only and can create an item, their own personal
- items in folders they cannot access;
- items restricted to other users or roles.
The attachments are removed from their item at the same time. Attachments of other users'
personal items cannot be decrypted this way, because their key is only shared with their owner,
but they are still taken from the owner's item.
- Replacement. Any user can make a file of their choice appear as an attachment of an item they
cannot edit, if an editor saves that item while the upload happens.
Patches
Fixed in 3.2.3.3:
- Deleting an attachment requires the edit right on its item. That check also covers item
restrictions, read-only accounts and administrators.
- Each upload is recorded in the session that made it. Only those files are attached to a new item
or confirmed when an item is saved.
- An upload to an existing item requires the edit right on it.
- The temporary id of a new item may not designate an existing item.
Workarounds
No setting disables attachments. Until the upgrade:
- Review the attachment deletions. TeamPass logs them under the user who made them (default table
```sql
SELECT l.date, l.id_item, l.id_user, l.raison
FROM teampass_log_items AS l
WHERE l.action = 'at_modification' AND l.raison LIKE 'at_del_file : %';
```
- Look for attachments that left the item they were uploaded on. An attachment never changes item
```sql
SELECT f.id AS file_id, l.id_item AS uploaded_on_item, f.id_item AS now_on_item, l.id_user AS uploaded_by
FROM teampass_files AS f
JOIN teampass_log_items AS l
ON l.action = 'at_modification'
AND l.raison LIKE CONCAT('at_add_file : %:', f.id)
WHERE l.id_item <> f.id_item;
```
Attachments uploaded while their item was being created are not logged with `at_add_file`. This
query cannot see them if they were moved.
References
- Release notes: https://github.com/nilsteampassnet/TeamPass/releases/tag/3.2.3.3
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.3.3 | — | — |
3.2.3.3Arsenal 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-r6r4-5mr3-rppmLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
