GHSA-8FG2-3GPC-X8M7
Multiple stored cross-site scripting vulnerabilities across the web UI, API and log tables
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-8FG2-3GPC-X8M7 divulgada · CVSS 9.3 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
Sixteen stored cross-site scripting vulnerabilities affect TeamPass releases before 3.2.0.3. They
share five root causes: a client-side purifier that could be bypassed, log tables serialised by
string concatenation instead of `json_encode()`, client-side code that reversed the server's own
output escaping, user-controlled values concatenated into HTML strings, and a session value echoed
into a JavaScript comment.
Most require an authenticated account with item, folder, role or import access. One does not: an
unauthenticated attacker can seed a payload into the failed-login log through a proxy header.
Impact
A stored payload executes in the browser of another user — in several cases specifically an
administrator or manager, since the affected screens are the administration, log and user-rights
views. Execution happens in the TeamPass origin, which for a password manager means the victim's
authenticated session and everything reachable from it.
Details
1. Client-side purifier bypass — 3 issues
`prepareExchangedData(…, 'decode', …)` routes every AJAX response through `purifyData()` →
`simplePurifier()`. That function decoded HTML entities and then skipped DOMPurify entirely
whenever the decoded string contained the substring `img`, handing the decoded markup back to the
caller. Every screen inserting the result with jQuery `.html()` / `.append()` rendered it as live
markup.
Reached through the item-description preview in the folder item list, the item search results
(`label`, `description`, `folder`), and the per-user visible-folders view (`folder.title`).
*Fix:* the `includes("img")` clause was removed, so DOMPurify is always applied.
2. Log tables built by manual JSON concatenation — 4 issues
Several `sources/logs.datatables.php` responses were assembled by string concatenation rather than
`json_encode()`. HTML escaping (`htmlspecialchars()` / `secureOutput()`) does not make a value safe
in a JSON string context and leaves backslashes untouched, so a stored value carrying a literal
`<img src=x onerror=…>` sequence survives storage, is turned into real `<` and `>` by the
browser's JSON parser, and is then rendered as HTML by DataTables. No literal angle bracket ever
exists for the HTML encoder to catch.
Reached through background-task display values, `send_email` task recipient names
(`receiver_name`, `login`, `email`, `receivers` — the last one settable through item email sharing)
and item labels in the finished-task and log tables.
*Fix:* a `tpDatatableJsonCell()` helper (`json_encode` with the `JSON_HEX_*` flags) is applied to
every user-controlled cell.
3. Client-side reversal of server-side escaping — 2 issues
`app/pages/utilities.logs.js.php` ran `decodeHtmlEntities()` over columns that the server had
deliberately escaped with `htmlspecialchars()`, then returned the result as DataTables HTML cell
content — undoing the server's output encoding immediately before insertion.
Reached through the Connections log (user `name`, `lastname`, `login`, which LDAP/OAuth
provisioning can supply) and the failed-login log's IP column.
The IP column is the most severe of the batch. Failed logins call `logEvents()` with an empty
actor, which falls back to `getClientIpServer()`; that helper trusted proxy headers such as
`X-Forwarded-For` without validating that the value was an IP address. An unauthenticated
attacker could therefore store markup by sending one failed login attempt, and it executed when a
privileged user opened the failed-login log.
*Fix:* the renderers now decode for readability and re-escape before insertion
(`$('<div/>').text(decodeHtmlEntities(data)).html()`), and `getClientIpServer()` validates every
proxy-header candidate with `FILTER_VALIDATE_IP` before accepting it, falling back to
`REMOTE_ADDR`.
4. User-controlled values concatenated into HTML strings — 6 issues
Six screens built markup by concatenation and inserted it with `.html()` / `.append()`, or passed
it to Toastr (which treats messages as HTML by default), with no escaping:
| Screen | Value |
| --- | --- |
| Subfolder list in the items view | `folder.title` |
| Per-user folder-rights role badges | `role.title` |
| Admin transparent-recovery statistics modal | `event.login` |
| Item-deleted WebSocket toast | `data.label` |
| Backup administration list | `tp_files_version`, read verbatim from a `.meta.json` sidecar |
| Item list | `fa_icon`, settable through the API `icon` parameter and rendered inside a `class` attribute |
*Fix:* escaping at the sink (`htmlEncode()` / `escapeHtml()` / `escapeAttribute()`), plus
server-side allow-listing of `fa_icon` in `ItemModel` on both create and update, and a
version-format check on backup metadata. The same change also corrected the `item_deleted`
WebSocket event to target the item's real `id_tree` instead of the caller-supplied `folder_id`.
5. Session language echoed into a JavaScript comment — 1 issue
`app/pages/items.js.php` echoed the session language into a `//` comment, encoded with
`htmlspecialchars()` — an HTML-context encoder that does not escape JavaScript line terminators. A
stored `user_language` containing a newline terminated the comment and injected executable
JavaScript into the page.
*Fix:* the comment is static, and the inline `user_language` update is constrained to an
allow-list built from the `languages` table.
Patches
Fixed in 3.2.0.3 by commit `34b1316d7` ("Fix stored XSS across web UI, API and log tables"),
which touches `app/includes/js/functions.js`, `app/includes/js/teampass-websocket-init.js`,
`app/pages/{admin,backups,items,users,utilities.logs}.js.php`,
`app/sources/{backup.functions,backups.queries,items.queries,logs.datatables,main.functions,users.queries}.php`,
`app/api/Model/ItemModel.php` and the served copies under `public/assets/js/`.
Upgrade to the latest release.
Workarounds
None. The affected code paths are core UI and logging; the only remedy is to upgrade.
Relationship to other advisories
Distinct from GHSA-r298-6mxv-j9hc (raw item labels stored by the API and rendered in the
recycle-bin listing, fixed in 3.2.1.0) and from GHSA-9g8h-6qg5-cmhx (residual encoding defects
still live in 3.2.1.5, fixed in 3.2.1.6). The version ranges do not overlap and the affected sinks
are different.
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.0.3 | — | — |
3.2.0.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-8fg2-3gpc-x8m7Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
