GHSA-7WVW-WXQX-V364
Admin actions in admin.queries.php skip the session-key check, letting a same-site forged request toggle the API, delete old logs or start/stop the WebSocket server
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:L/A:L
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-7WVW-WXQX-V364 divulgada · CVSS 4.2 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
`app/sources/admin.queries.php` dispatches the actions of the administration pages from a single `switch`. Most cases start by comparing the posted `key` with the session key (`$post_key !== $session->get('key')`). That per-request token is what proves a request comes from a TeamPass page. Ten cases skipped the check:
- the four state-changing actions reported here: `save_api_status`, `clean_old_logs`, `websocket_start` and `websocket_stop`;
- two actions that only write a log row: `test_encryption` and `export_statistics`;
- four read-only actions: `get_dashboard_stats`, `get_system_status`, `get_system_health` and `websocket_status`.
A POST that carried a signed-in administrator's session cookie but no key ran them.
Details
Paths and line numbers are those of 3.2.4.1 (the file is identical on the development branch).
- `public/sources/admin.queries.php` loads `app/sources/admin.queries.php`. The CSRF protector (`csrfProtector::init()`) runs only in the front controller `public/index.php`. Nothing checks `Origin`, `Referer` or `Sec-Fetch-*` on `sources/*.queries.php`, so the session key is the only intent check there.
- The file-level gate (`:77-86`) checks the session, the `admin` page right, a user id and a non-empty session key. It proves that an administrator is signed in, not that the administrator sent the request.
- Cases without the key check:
| Line | Case | Effect | Called by the UI |
|---|---|---|---|
| 387 | `save_api_status` | Writes `misc` `admin/api` (REST API on/off) from `status`; when enabling with an empty `browser_extension_fqdn`, fills it from `cpassman_url` | No |
| 4188 | `websocket_start` | Starts the WebSocket server (`exec()` of `app/websocket/bin/server.php`, or `sudo systemctl start teampass-websocket`) | Yes, with the key |
| 4314 | `websocket_stop` | Stops it (`posix_kill()` on the process listening on the configured port, or `sudo systemctl stop teampass-websocket`) | Yes, with the key |
| 4413 | `clean_old_logs` | Deletes the `log_items` and `log_system` rows older than 90 days | No |
| 4470 | `test_encryption` | Writes one `log_system` row | No |
| 4544 | `export_statistics` | Writes one `log_system` row and returns a CSV | No |
| 3227, 3467, 3518, 4106 | `get_dashboard_stats`, `get_system_status`, `get_system_health`, `websocket_status` | Read-only | Yes, with the key |
- Every response except the CSV is encrypted with the session key, and the same-origin policy blocks cross-origin reads, so a forged request is blind.
What limits the attack. Since 3.1.2 the session cookie is explicitly set to `SameSite=Lax` (`app/vendor/teampassclasses/sessionmanager/src/SessionManager.php:80-86`).
- A cross-site POST does not carry the cookie. Chrome's two-minute "Lax + POST" exception applies only to cookies without a SameSite attribute.
- The handlers read POST only, so a top-level GET navigation does nothing.
An attacker therefore needs a page on the same site: another host under the same registrable domain, such as a sibling subdomain (with the same scheme, on Chromium). A browser that ignores SameSite also works. Script running on the TeamPass origin itself gains nothing from this flaw, because it can read the key from the page.
Affected versions.
- `save_api_status` has had no key check since 3.0.0.0.
- The other cases arrived in 3.1.5.4 (dashboard and quick actions) and 3.1.7.0 (WebSocket control).
- In 3.0.10 to 3.1.1 the `ini_set('session.cookie_samesite', 'Lax')` line of `index.php` is commented out and the session cookie has no SameSite attribute, unless `php.ini` sets `session.cookie_samesite`. On those versions, a cross-site POST could also toggle the API.
Proof of concept
- Sign in as an administrator and note the `PHPSESSID` cookie.
- With that cookie only, and no `key` field, send:
- `type=clean_old_logs` deletes the log rows older than 90 days in the same way.
- As a control, `type=network_get_rules` without a key returns `key_is_not_correct`.
Impact
Through a page on the same site, an attacker can make a signed-in administrator's browser do the following:
- Turn the REST API on or off.
- Turning it on grants nothing by itself. `/api/authorize` still needs an account that is allowed to use the API, its password and its personal API key, and token sign-in needs a valid token.
- Turning it off stops the API clients (browser extension, scripts).
- Delete the item and system logs older than 90 days. This covers password history in `log_items`, old authentication failures and old administration events. The deletion is itself logged, as `admin_action/clean_old_logs` under the administrator's account.
- Start or stop the WebSocket server. It only carries real-time updates, and no security control depends on it. The commands are fixed: nothing from the request reaches the shell.
No data is disclosed and no privilege is gained.
Patches
Fixed in 3.2.4.2. Before doing anything, every case of `admin.queries.php` now refuses a request whose `key` differs from the session key, as the other cases already did. A unit test (`tests/Unit/AdminQueriesSessionKeyTest.php`) checks this on every case of the switch.
Workarounds
- Serve TeamPass on a registrable domain that hosts no other site where third parties can publish content.
- Otherwise, sign out of TeamPass before browsing the sibling sites.
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.2 | — | — |
3.2.4.2Arsenal 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-7wvw-wxqx-v364Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
