GHSA-CCC7-VC5R-QP79
Missing item access check in utils.queries.php "server_auto_update_password_frequency" lets any signed-in user modify any item by id
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-CCC7-VC5R-QP79 divulgada · CVSS 4.3 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
The `server_auto_update_password_frequency` action of `sources/utils.queries.php` updates the `auto_update_pwd_frequency` and `auto_update_pwd_next_date` columns of the item whose id the caller posts. It does not check that the caller may access that item. Any signed-in user, with no manager or admin role, can therefore change these fields on items in folders they have no rights to, including other users' items.
Details
- `public/sources/utils.queries.php` (lines 6-10) forwards to `app/sources/utils.queries.php`.
- `app/sources/utils.queries.php` (lines 70-78): the only file-level guard is `userAccessPage('items')` plus `checkSession()`. `items` is in the page list of every ordinary user (`app/includes/libraries/teampassclasses/performchecks/src/PerformChecks.php`, lines 199-202).
- `app/sources/utils.queries.php` (lines 201-225): the case compares only the posted `key` with the caller's own session key and checks that `id` and `freq` are present. It then runs:
DB::update(
prefixTable('items'),
[
'auto_update_pwd_frequency' => $post_freq,
'auto_update_pwd_next_date' => time() + (2592000 * $post_freq),
],
'id = %i',
filter_input(INPUT_POST, 'id', FILTER_SANITIZE_FULL_SPECIAL_CHARS)
);- There is no test of the item's folder against the user's accessible folders, no owner, personal-folder or `restricted_to` check, and no read-only check. The case is also not gated by `enable_server_password_change`, so it is reachable in the default configuration.
- The session key is rendered into the items page JavaScript for every user (`app/pages/items.js.php`, lines 3369-3375), so the caller knows it.
- The sibling write handler in `app/sources/classification.queries.php` (lines 203-210) loads the item with `$loadAccessibleItem($post_item_id)` and stops if it returns null. `items.queries.php` `show_details_item` also refuses the same item for the same user ("You are not allowed to access this item").
- The request is accepted from any account that can open the Items page, read-only users and administrators included; administrators have no item access in TeamPass by design. It also works on deleted items and on other users' personal items.
- The update does not go through the item history, so the change leaves no trace in the item's log.
The handler has not changed since 3.0.0.0.
Proof of concept
Tested against TeamPass 3.2.4.3 (image built from the repository's own `Dockerfile`, with mariadb:11.2), local Docker copy, default configuration apart from what a fresh install needs (installer completed, install folder removed, maintenance mode turned off). No code changes. The result is from that one build, run in an automated sandbox.
Setup: folders `PoC-Private` (id 1) and `PoC-Other` (id 2); role `PoC-Owner` (write on folder 1) and role `PoC-Other` (write on folder 2); user `pocowner` (role PoC-Owner) and user `poccaller` (role PoC-Other), neither admin, manager, HR or read-only. `pocowner` created item `PoC-item` (id 1) in `PoC-Private`. `$SID` is `poccaller`'s PHPSESSID cookie and `$KEY` is `poccaller`'s own session key (the `key:` value printed after `server_auto_update_password_frequency` in the Items page source). The item row is read from the database, because the handler's response does not show the change.
1. Control: a wrong session key is refused, and the row is unchanged
curl -s -H "X-Requested-With: XMLHttpRequest" -H "Cookie: PHPSESSID=$SID" \
--data "type=server_auto_update_password_frequency&id=1&freq=1&key=wrong-key-control" \
http://TARGET:8080/sources/utils.queries.phpResult: `200`, an encoded error body (`eyJjaXBoZXJ0ZXh0Ijoi...`), not `[{"error" : ""}]`. Without any session cookie the same request returns the HTML page instead of the handler's answer. As `poccaller`, `items.queries.php` `show_details_item` for item 1 returns "You are not allowed to access this item".
2. Before: the item row
mariadb -uteampass -p teampass -e "select id,label,id_tree,auto_update_pwd_frequency,auto_update_pwd_next_date from teampass_items where id=1;"Result: `1 PoC-item 1 0 0`
3. The request that should be refused but is not
curl -s -H "X-Requested-With: XMLHttpRequest" -H "Cookie: PHPSESSID=$SID" \
--data "type=server_auto_update_password_frequency&id=1&freq=1&key=$KEY" \
http://TARGET:8080/sources/utils.queries.phpResult: `200`, body `[{"error" : ""}]`
4. After: the item row
mariadb -uteampass -p teampass -e "select id,label,id_tree,auto_update_pwd_frequency,auto_update_pwd_next_date from teampass_items where id=1;"Result: `1 PoC-item 1 1 1797499659` (frequency 0 became 1; next date is the current time plus 2592000 seconds). Item 1 is in a folder that `poccaller`'s role does not grant.
Impact
Any authenticated user can set or clear the auto-update-password frequency and next-date of any item by id, including items in folders they cannot read and other users' items. The response is the same whether or not the id exists, and no secret is disclosed. This is an authorization failure on a write (a user acting beyond their folder rights). The effect shown is limited to these two item attributes; the code read does not show anything that acts on the changed values.
Every reader of the two columns was checked. `auto_update_pwd_next_date` is not read anywhere in 3.x. `auto_update_pwd_frequency` is shown in the item view only when *Enable changing password on distant server* (`enable_server_password_change`, off by default) is on, and only to users who can already open the item; a search filter also uses it, limited to items the searcher can access. The server-side password change that once acted on these values was removed in 3.1.4.13. The effect is therefore a misleading "auto update" status on items outside the caller's rights, with no disclosure and no password change.
Patches
Fixed in 3.2.4.5. Before the update, the handler:
- refuses the request unless *Enable changing password on distant server* is enabled;
- refuses a deleted, inactive or missing item;
- requires edit rights on the item through `getCurrentAccessRights()`: folder scope, read-only status, personal folders, user and role restrictions. No edition lock is taken;
- casts the id to an integer and accepts only the frequencies the form offers, 0 to 4.
Workarounds
None short of upgrading. Keeping *Enable changing password on distant server* off does not help, since the handler did not check it.
Credits
Reported independently by Aditay Kumar (`adityasunny06help-coder`), who reported it first and showed the case of a folder member excluded by an item restriction, and by `benchmeister`.
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-ccc7-vc5r-qp79Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
